Rob van der Woude's Scripting Pages

Solutions found in alt.msdos.batch

and alt.msdos.batch.nt

Remove registry entries in Windows 95

Also posted to alt.msdos.batch by Bill James, this message tells you how to remove Windows 95 registry entries with batch files, using RUNDLL.EXE and *.INF files.

You need an .inf file for this, which you can create and run from a batch
file.  There doesn't seem to be much clear information on .inf file
construction, but here are some notes I put together previously:

There are 2 different processes involved, depending on whether you want to
delete an entire key, or just delete a Value within a key.

To delete an entire key, you create an .inf file that looks like this.

    [Version]
    Signature="$CHICAGO$"
    [DefaultInstall]
    DelReg=DeleteMe
    [DeleteMe]
    HKEY,"RegistryString\Goes\Here"

For HKEY, substitute:

    HKCR = HKEY_CLASSES_ROOT
    HKCU = HKEY_CURRENT_USER
    HKLM = HKEY_LOCAL_MACHINE
    HKU  = HKEY_USERS.

The command to process the .inf file is "C:\WINDOWS\rundll.exe
setupx.dll,InstallHinfSection DefaultInstall 132 Path\FileName.inf" (w/o
quotes).  You would echo each line from the batch file to create the .inf
file, run it, then delete the .inf file.  You must specify the full path to
the .inf file.

For example, a harmless little batch file which will remove the MRU List for
Wordpad (key will be recreated the next time you use WordPad).

   @echo off
   ::This batch files clears the most recently used list for WordPad.
   echo [Version] > %temp%\WpadMRU.inf
   echo Signature="$CHICAGO$"  >> %temp%\WpadMRU.inf
   echo [DefaultInstall] >> %temp%\WpadMRU.inf
   echo DelReg=DeleteMe >> %temp%\WpadMRU.inf
   echo [DeleteMe] >> %temp%\WpadMRU.inf
   echo
HKCU,"Software\Microsoft\Windows\CurrentVersion\Applets\WordPad\Recent File
List" >> %temp%\WpadMRU.inf
   C:\WINDOWS\rundll.exe setupx.dll,InstallHinfSection DefaultInstall 132
%temp%\WpadMRU.inf
   del %temp%\WpadMRU.inf

Watch out for wrapping of the long lines.  The indentation is your clue.

To delete just a Value from a key, you use AddReg, with ",4," (no quotes).

    [Version]
    Signature="$CHICAGO$"
    [DefaultInstall]
    AddReg=KillValue
    [KillValue]
    HKEY,"RegistryString\Goes\Here","KeyValue",4,

All commas and quotes must be included - don't miss the comma after 4 at the
end.

There is also some information on .inf files in this MS Knowledge Base
article:  support.microsoft.com/kb/q171424/

When learning/testing, make sure you have a good backup of system.dat and
user.dat (Windows Registry), and know how to restore those from DOS boot if
you screw up.

Bill James

Brandon wrote in message <01bed494$81c2d3f0$a65a0baa@3555nt>...
>Is there a way I can remove selected Windows 95 Registry keys from a batch
>file?
>I would like to create a batch file that will allow me to remove selected
>IE4 registry keys.  I know what keys I would like to delete, although
>creating a program for others to use would be nice.
>
>Thank You,
>
>Brandon

page last modified: 2011-03-04; loaded in 0.0105 seconds