Search code examples
batch-filewindows-7registryinstallshield

Deleting Registry Key with Batch Script from Uninstall


I have a batch script that deletes certain registry keys, it works as a script itself and also from the command line. However, as part of an uninstaller (Installshield), one of the 2 registry keys does not delete. My log file indicates that "the operation completed successfully" but for the life of me, the key is still there.

The command looks like this:

REG DELETE "HKEY_LOCAL_MACHINE\SOFTWARE\ProgramName\SubEntry" /f

and my log file:

REG DELETE "HKEY_LOCAL_MACHINE\SOFTWARE\ProgramName\SubEntry" /f

The operation completed successfully.

I can run the batch script itself as an admin and it works, I always run the installer (to install and uninstall) as an admin.


Solution

  • I fixed the issue. Since the installer is 32-bit, it was looking in the 32-bit entries in the registry (under WOW6432Node). By specifying /reg:64 at the end of my command it deleted the correct entry. I got the solution from this post.