Forum Discussion
Installing multiple MSI's
Wait is a directive to the hosting process to actively poll the process it created and not exit until the child process has indicated it has exited.
Not using the wait method results in the calling process starting the new process and exiting immediately. This is why cmd.exe has the "/c" parameter, the "start" command has the "/wait" parameter and Start-Process has the "-Wait" parameter, to name some examples.
Using .NET as the reference point, this equates to the functionality described in the WaitForExitAsync() method (usually - there's variations.)
Calling from an ongoing process such as a console shell often works where calling from inside other hosts like the task scheduler environment or even the "Run" box within the Windows Start menu can yield early which results in processes terminating early. Which is why they supply some form of "wait" option as a means for receiving such a directive.
So, it's not a one-size-fits all answer since it depends on your starting point but my guess is that those commands are executing in something other than a persistent shell. I'm basing that on the statement that first command leverages the "wait" and works while the second does not.
Process.WaitForExitAsync(CancellationToken) Method (System.Diagnostics) | Microsoft Docs
The .NET reference is just for further reading if you're interested. The concept is old and has nothing to do with .NET.
Cheers,
Lain