Wipedir : uninstall utility for developers


Most software packages written for Windows have an uninstall facility. However, there is no easy way to delete files that may already be open. The purpose of WipeDir is to facilitate the development of uninstall methods for small applications by allowing directories containing open files to be deleted as cleanly as possible.

The typical problem when uninstalling an application called GeeWhizz is that because the uninstall program itself is open (\program files\GeeWhizz\uninst.exe) it prevents the directory from being deleted. In this instance, provided the file wipedir.exe is located in the GeeWhizz directory, removal of the directory is achieved by the command wipedir /self.

How do I use WipeDir?

The WipeDir package includes two programs being wipedir.exe and wipedirC.exe. The first is a standard GUI Windows program. The second as a console version for use in batch files. Both versions must be called with command-line parameters - the user is not prompted for a directory to delete.


wipedir FullDirName [switches]
    or, for console use
wipedirC FullDirName [switches]


- used as an alternative to a directory name.
- requires no user interaction.
- fail if unable to delete dir without restarting Windows.
- display a Windows progress dialog (GUI version only).
- do not check existence of file wipedir.ini

Security Check

Before attempting to delete a directory, the existence of the file wipedir.ini is checked.
If this file does not exist :-

This feature is intended to prevent accidental deletion of files during development and testing.
Keep the file wipedir.ini in an otherwise empty directory. Include it when building an installation package. This should ensure accidental deletion of files is prevented but sensible backup protocols are always advisable. Also see switches.


WipeDir attempts to delete the required directory using the Windows API function SHFileOperation.

When the /self switch is used :-

How are directories deleted on restart?

A command is saved in the Windows Registry. The command is run automatically (and deleted) when Windows is next restarted. The table below lists the registry key and the required command.

Key HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce
Win NT/2000/XP  
cmd.exe /C RD /S /Q DirName
Win 95/98/ME


wipedir %Temp%\GeeWhizzInstaller /noconfirm
wipedirC -norestart -noconfirm "C:\Program Files\GeeWhizz"
"C:\Program Files\GeeWhizz\wipedir" /self /showprogress


 - you MUST close the returned thread and process handles.
 - recommended