How to Uninstall .exe silently in c++

2k views Asked by At

I have UninstallString and I want to uninstall the program silently so that no user interaction involved. I have the UninstallString like the following :

  • C:\Program Files\Notepad++\uninstall.exe
  • C:\Program Files\7-Zip\Uninstall.exe
  • C:\xampp\uninstall.exe

    and so on ...

I have opened these as a process But I don't know how to uninstall it silently.

I have heart some approach like find the windows and then send the OK keyStrokes but I don't know how to do it.

if it is a windows installer then we can use something like...

 MsiExec.exe /I{GUID} /q 

But how to do for above UninstallString which have .exe as the path.

Any help/Approaches will be highly appreciated.

Thanks a lot.

2

There are 2 answers

6
MAQ678 On BEST ANSWER

Silent uninstall command varies on different installer.

For example,

If installer is built using Wix toolset, it supports commands like: /s, /S, /qn, /quiet . i.e,

UninstallString /quiet

For, NSIS based installer, /S .

For, Install4j based installer, -q .

For, Inno-setup based installer, /SILENT, /VERYSILENT .

etc.

You can find details about Silent install parameters from this site.

Moreover, there has a tool called WMIC. Some people also directing to use this. You can find it from this link. [Though it did not work for me]

0
Jean Fiedler On

As MAQ678 already told there are plenty of different Installer Type. Sometimes (mostly not, because Publishers are lazy) you can find the silent uninstall switch in the registry under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall if the package has an QuietUninstallString entry.