I need to push the upgraded package to all users through SMS. And I created a winbatch script to remove the old version as follows:



;Remove PicPick if installed

If RegExistKey(@REGMachine,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{C3B2519F-D5AE-41B9-91CA-234ED2831F5D}") == @TRUE

RunHideWait ("MsiExec.exe", "/qb! ALLUSERS=2 /x {C3B2519F-D5AE-41B9-91CA-234ED2831F5D}")


The problem with this script is that the program PicPick could not be uninstalled thoroughly if it is running during the uninstallation, so we need to have the PicPick exited before we run the script to uninstall it.

I am new at scripting and not good at it. Can anyone help me to enrich the above script so that it can exit picpick.exe first and then uninstall it?

Many thanks in advance!