4

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...

0

2 Answers 2

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

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .