Runs an external program and pauses script execution until the program finishes.
RunWait ( "filename" [, "workingdir" [, show_flag [, opt_flag ]]] )
Parameters
| filename | The name of the executable (EXE, BAT, COM, PIF) to run. |
| workingdir | [optional] The working directory. |
| show_flag | [optional] The "show" flag of the executed program: @SW_HIDE = Hidden window (or Default keyword) @SW_MINIMIZE = Minimized window @SW_MAXIMIZE = Maximized window |
| opt_flag | [optional] Controls various options related to how the parent and child process interact. 0x10000 ($RUN_CREATE_NEW_CONSOLE) = The child console process should be created with it's own window instead of using the parent's window. This flag is only useful when the parent is compiled as a Console application. |
Return Value
| Success: | Returns the exit code of the program that was run. |
| Failure: | Returns 0 and sets @error to non-zero. |
Remarks
To run DOS commands, try RunWait(@ComSpec & " /c " & "commandName") ; don't forget " " before "/c"
Related
ProcessWait, ProcessWaitClose, Run, ShellExecute, ShellExecuteWait, RunAs, RunAsWait
Example
$val = RunWait("Notepad.exe", @WindowsDir, @SW_MAXIMIZE)
; script waits until Notepad closes
MsgBox(0, "Program returned with exit code:", $val)