Runs an external program and pauses script execution until the program finishes.
RunWait "filename" [, "workingdir" [, flag]]
Parameters
filename | The name of the executable (EXE, BAT, COM, PIF) to run. |
workingdir | [optional] The working directory. |
flag | [optional] The "show" flag of the executed program: SW_HIDE = Hidden window SW_MINIMIZE = Minimized window SW_MAXIMIZE = Maximized window |
Return Value
Success: | Returns the exit code of the program that was run. |
Failure: | see Remarks. |
Remarks
After running the requested program the script pauses until the program terminates. To run a program and then immediately continue script execution use the Run function instead.
Related
ProcessWait, ProcessWaitClose, RunAsSet, RunWait
Example
Set oAutoIt = WScript.CreateObject("AutoItX3.Control")
val = oAutoIt.RunWait("Notepad.exe", "C:\WINDOWS", oAutoIt.SW_MAXIMIZE)
' script waits until Notepad closes
WScript.Echo "Program returned with exit code:" & val