ShellExecute
From AutoIt Wiki
Runs an external program using the ShellExecute API. Adapted from AutoIt docs.
Contents |
Syntax
ShellExecute ( "filename" [, "parameters" [, "workingdir" [, "verb" [, showflag]]]] )
Parameters
| filename | The name of the file to run (EXE, .txt, .lnk, etc). |
| parameters | [optional] Any parameters for the program. Blank ("") uses none. |
| workingdir | [optional] The working directory. Blank ("") uses the current working directory. |
| verb | [optional] The "verb" to use, common verbs include:
default = Uses the default action as defined in the operating system
|
| showflag | [optional] The "show" flag of the executed program:
true (or no parameter) = Normal window (the default)
|
Return Value
Success: Returns 1.
Failure: Returns 0 and sets @error to non-zero.
Remarks
After running the requested program the script continues. To pause execution of the script until the spawned program has finished use the ShellExecuteWait function instead.
When no verb is specified the default verb is used. The default verb is the verb configured in the registry. If no verb is set as default in the registry then the "open" verb is used. If the "open" verb is not present then the first verb listed in the registry is used (except on Windows 2000).
Related Functions
ShellExecuteWait, Run, RunWait, RunAsWait
Example
; Open Notepad
ShellExecute("Notepad.exe")
; Open a .txt file with it's default editor
ShellExecute("myfile.txt", "", @ScriptDir, "edit")