If you have a msi you want to uninstall from the command line, doing MsiExec.exe /qn /X{26A24AE4-039D-4CA4-87B4-2F83217045F0} /norestart
for instance, returns immediately. But msiexec.exe is running for some amount of time, maybe for minutes. So if I'm scripting around this to want to then do an install - how do I know if it's done? I can't just watch msiexc.exe because it's also a service process, so won't ever go away...
Asked
Active
Viewed 567 times
4
![](../../users/profiles/197769.webp)
jmp242
- 668
- 3
- 13
2 Answers
2
Use "start" command with /wait to wait until process has exited.
start "" /wait msiexec /x ...
"" is a workaround, should any following attributes contain quotes. http://ss64.com/nt/start.html
![](../../users/profiles/8334.webp)
Don Zoomik
- 1,458
- 9
- 12
2
The msiexec error codes are documented here. When you get an error code, such as zero meaning success, msiexec considers itself done.
To capture the error codes one could for instance wrap the execution in powershell, such as done here (shameless code copy/paste):
(Start-Process -FilePath "msiexec.exe" -ArgumentList "<<whatever>>" -Wait -Passthru).ExitCode
Modify to suit your needs.