0
votes

I want to execute a DOS command from WIX. The command goes like:

[SystemFolder]cmd.exe /c rmdir /s /q [INSTALLDIR]

Basically I want to delete the Installation Directory from the command prompt during Uninstall.

I want to use the SystemFolder property to specify the cmd.exe path. And the most important one is that, I don't want the command window to appear during Uninstall.

1
Note that unconditionally recursively deleting a directory might be a very bad idea if, say, someone manages to install to C:\.Michael Urman
Windows installer already removes the installed components on uninstall. Why do you think you need this?Wim Coenen
After installation, when user runs my application, it creates some files in the Installation Folder. Now when user tries to uninstall it, it removes only the files Installed by MSI. Since the Installation folder contains some more files which were not installed by the MSI, the Installation folder is not removed during uninstall.The King
@TheKing: doesn't that cause problems when the application is started by a user who doesn't have administrative privileges? It's probably better to write such files to an application specific folder under %programdata% (for all users) or %appdata% (separate for each user).Wim Coenen

1 Answers

6
votes

I believe that the correct fix for this issue would be to remove the files that are created by the application using WIX. You can use the RemoveFile element in order to delete files.

You can find a complete example on how to remove all those files here: Removing files when uninstalling WiX