Archive: RMDir switches


RMDir switches
I'm trying to discern the drawbacks of using /r and /REBOOTOK with RMDir. I haven't gotten very far, even after reading some older posts and concerns.

Could someone please advise me on how to decide on whether to use these switches in my installers?

Thank you very much.


Not much of a problem with using rebootok, except maybe that it'll pop up a 'reboot?' question on the finish page. /r however is EXTREMELY dangerous. It will delete any files, even if they don't belong to your software. Let's say your uninstaller.exe is moved from your application's directory to c:\windows. The $instdir variable will then be C:\windows as far as your uninstaller is concerned. So the command 'RmDir $INSTDIR /r' will delete ALL files and subfolders of C:\windows. You do not want this to be possible, not even in a very unlikely scenario.

Even if you add a verification for the value of $instdir, /r is dangerous. If a user installs/copies something to your installation directory, they do not expect that to be deleted automatically when they uninstall your product. Same problem if some idiot installs your software to an already existing directory (like C:\Program Files).