Followers 0

# What Can Run Open?

## 8 posts in this topic

I notice when I use Run to open anything but an .exe the script aborts and closes. Does Run only open .exe? What if I want to open a Folder? Or the AutoIt Beta Help File (AutoIt.chm)?

Func Open_Work_Stuff ()
Run ("C:\Program Files\SciTE\SciTe.exe")
Sleep (3000)
Run ("C:\Program Files\AutoIt3\beta\AutoIt.chm")
Sleep (5000)
Run ("C:\Documents and Settings\[Secret]\My Documents\Personal\AutoIt")
EndFunc

##### Share on other sites

maybe

$Run = FileGetShortName("C:\Program Files\AutoIt3\beta\AutoIt.chm") Run(@ComSpec & " /c " &$Run, "", @SW_HIDE)

8)

##### Share on other sites

The name of the executable (EXE, BAT, COM, or PIF) to run.

Func Open_Work_Stuff ()
Run (@ProgramFilesDir & "\SciTE\SciTe.exe")
Sleep (3000)
Run ('HH.exe "' & @ProgramFilesDir & '\AutoIt3\beta\AutoIt.chm"')
Sleep (5000)
Run ("Explorer " & @MyDocumentsDir & "\Personal\AutoIt")
EndFunc

To run non executable file, then just run the program that executes them as above.

##### Share on other sites

maybe

$Run = FileGetShortName("C:\Program Files\AutoIt3\beta\AutoIt.chm") Run(@ComSpec & " /c " &$Run, "", @SW_HIDE)

8)

Thank you, it did work for the .chm, but not for opening the Folder Directory. So that I can better understand what is going on here, and avoid further posts, would you mind letting me know what is going on in your code?

For instance, is "@ComSpec" using "cmd.exe"? What is the "/c" for? And what are you hiding (@SW_HIDE)?

##### Share on other sites

"@ComSpec" using "cmd.exe"?... yes

What is the "/c" for?... to close the cmd window, try /k to keep it open

(@SW_HIDE)?... hides the cmd window

8)

##### Share on other sites

this works for the folder also

$Temp = FileGetShortName(@MyDocumentsDir & "\Personal\AutoIt") Run(@ComSpec & " /c Start " &$Temp, "", @SW_HIDE)

start uses the registered program that is associated to the file/program being opened

8)

##### Share on other sites

this works for the folder also

$Temp = FileGetShortName(@MyDocumentsDir & "\Personal\AutoIt") Run(@ComSpec & " /c Start " &$Temp, "", @SW_HIDE)

start uses the registered program that is associated to the file/program being opened

8)

Thanks! That helps a lot!

##### Share on other sites

The easiest way is to run explorer using your file path as an argument. Here is my code

for opening my Programs Folder:

Run("C:\Windows\Explorer.exe C:\Program Files")

Simply replace the last part in the command above with different file paths.

(Note: leave a space between the explorer command and your file path)