0

According to SS64, for .Run you can specify bWaitOnReturn to choose whether or not to wait for the process to terminate before your script continues.

SS64's details about .Exec do not mention whether or not the script will wait for the specified process to terminate before the script continues when .Exec is used.

The information for .ShellExecute also does not specify this important detail.

Do .Exec and/or .ShellExecute wait for the specified process to terminate before the script continues?

user692942
  • 16,398
  • 7
  • 76
  • 175
  • 2
    The two methods give different functionality, if you read the [official documentation](https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/scripting-articles/ateytk4a(v=vs.84)) you'd get a better idea of how `Exec` works. It creates an instance of [`wshScriptExec` object](https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/scripting-articles/2f38xsxe(v=vs.84)) that gives you fine grained control over the execution and monitoring of the running process and access to the various outputs (`StdIn`, `StdOut` and `StdErr`). – user692942 Mar 13 '21 at 09:44
  • The same goes for `ShellExecute` please [read the documentation](https://learn.microsoft.com/en-gb/windows/win32/shell/shell-shellexecute). – user692942 Mar 13 '21 at 10:24

0 Answers0