Reputation: 21
I have following 2 commands in powershell script file, but second command did not wait till first command gets executed.
cmd.exe /c "msiexec /i c:\Temp\mysql.msi /quiet"
cd "C:\Program Files (x86)\MySQL\MySQL Installer for Windows"
note: first command installing mysql installer at location C:\Program Files (x86)\MySQL\MySQL Installer for Windows"... In second command, i used cd to go to at directory C:\Program Files (x86)\MySQL\MySQL Installer for Windows"
Upvotes: 0
Views: 367
Reputation: 2024
Your PowerShell script does not know what the cmd.exe command is going to execute but it does wait for cmd.exe to finish.
The problem is that cmd.exe is not waiting for msiexec before returning.
If you wish to wait for msiexec to finish before moving on to your second command then call msiexec yourself using Start-Process with the -Wait parameter:
Start-Process -Wait -FilePath msiexec -ArgumentList "/i c:\Temp\mysql.msi /quiet"
Upvotes: 1