how to make an uninstaller on windows

im writing my own installer for windows and im wondering how i can let windows know what file to run in order to uninstall the installed program.

so, for example, if you go to your control panel and press the "remove a program" button, it comes up with a big list of programs, that is installed on your computer, which you can double click on to uninstall.

how would i go about getting my program in there?

do i make an uninstall.exe file and place it in a special folder or what?
Last edited on
closed account (E0p9LyTq)
Windows Installer has command line options for uninstalling a program.

https://msdn.microsoft.com/en-us/library/windows/desktop/cc185688(v=vs.85).aspx
@FurryGuy
OP says he is writing his own installer, not using Windows Installer.

@stav
You need to register your uninstaller with Windows. Specifically, you'll have to add your application to the registry

  HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

Create a new unique key. Many applications create a GUID, but the (unique) name of your app is fine.

  HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\RRabbits-3.14

Under your app's key, create a REG_SZ value called "UninstallString" with the full path to your application's uninstaller, plus any command-line arguments (if needed).

Other useful values are:

  DisplayIcon      REG_SZ "C:\Program Files (x86)\RRabits\rrabbits.exe"
  DisplayName      REG_SZ "Rabid Rabbits"
  DisplayVersion   REG_SZ "Version 3.14 AKA Easter Bunny Pellets"
  HelpLink         REG_SZ "http://some.url"
  InstallLocation  REG_SZ "C:\Program Files (x86)\RRabbits"
  Publisher        REG_SZ "Stav Industries Inc"
  VersionMajor     REG_DWORD 3
  VersionMinor     REG_DWORD 14

The DisplayIcon usually points to the executable because the executable has an embedded ico resource. If you wish, you could easily point it to an .ico file instead.

[edit]
If you peruse other application values with regedit, you'll see a lot of different values in there in addition to the ones I listed for you above. Don't bother -- they only have meaning in a specialized context that you are opting out of by writing this yourself.
[/edit]

RECOMMENDATION
You're killing yourself to write this yourself. Go get a copy of Inno Setup
http://www.jrsoftware.org/isinfo.php

Hope this helps.
Last edited on
thank you for the response, very detailed and high quality.
i wish we had a reputation system so i could "+rep" you :)
Last edited on
closed account (E0p9LyTq)
Duthomhas wrote:
OP says he is writing his own installer, not using Windows Installer.

I was very much aware of that.

If someone doesn't know how the Windows Installer does the work, the steps needed, the options available, creating a custom installer becomes much, much harder.

I could just as easily suggested a third party installer, as you did.
Topic archived. No new replies allowed.