Anonymous
08-28-1999, 08:59 AM
RegEdit is useful to ADD entries to the registry,
but is there a way to use it to DELETE entries in
the registry?
jstolz
08-28-1999, 05:32 PM
there was a post on this on Aug 25...
IceHawk
08-28-1999, 07:11 PM
Hey, goody some one is active. You just posted the message. JS, you have ICQ?
-IceHawk
ICQ: 18980024
jstolz
08-28-1999, 10:27 PM
Not any more... I never got any work done with that thing uh-ohing all the time!
Regards...
Anonymous
08-30-1999, 07:47 AM
Automate Deletions from The Windows 95 Registry
In the November 4, 1997, User-to-User column, reader Roy Lehrer showed how specific keys or values in the registry could be deleted using an INF file. The INF file can be "launched" in a couple of ways--by right-clicking the file in Explorer and selecting Install from the right-click menu, or by creating a shortcut to the file on the desktop and double-clicking its icon. (The latter method requires that "Install" be made the default action for files having the .inf extension.)
Building on these techniques, I created a file called Delurl.inf (Figure 1) which deletes the registry key URL History created by Netscape Navigator. This key contains the names of all URLs the browser has visited. (The full path is HKEY_CURRENT_USER\Software\Netscape\Netscape Navigator\URL History.)
In the registry, keys are analogous to folders, and values are analogous to files contained within folders. Just as deleting a folder will delete all the files it contains, deleting a registry key will delete all values associated with the key. In this case, deleting the URL History key will delete all its values--the list of visited URLs. You don't need to know the name of each specific URL.
The trick to launching an INF file from within a batch file--as you have suggested--is to precede the name of the file with the internal command associated with Windows 95's "Install" action. The name of the INF file can then be used as the command's argument. The internal command can be identified and inserted into a batch file in the following way:
Open Explorer. Click View, then Folder Options, then the File Types tab. A window listing all registered file types will appear. Scroll down to the item called Setup Information. Highlight that item, then click the Edit button. In the resulting Actions window, highlight Install, then click the Edit button. This opens a window called Editing Action for type: Setup Information. In the text box called Application used to perform action, you will see the highlighted command that defines Windows 95's "Install" action, which will look very much like this:
c:\windows\rundll.exe setupx.dll,InstallHinfSection DefaultInstall 132
Be careful not to strike a key accidentally at this point, or the entire highlighted string will be deleted! Copy the string to the Clipboard using Ctrl-C. Then repeatedly press Cancel to get out of Explorer. Open a batch file from which you want to launch your INF file, and paste the string at the beginning of a new line. At the end of the line, leave a space after the string, then type the full pathname of the INF file you want to launch.
When you run the batch file, it will execute the INF file. In this particular example, it will execute Delurl.inf, which deletes from the registry the URL History key (and therefore all its associated values--the list of visited URLs). This won't cause any problems for the browser. The URL History key is simply re-created automatically the next time the browser is launched.
The INF file shown here will work for the 32-bit version of Netscape Navigator 3.x. (The 16-bit version does not store a list of URLs in the registry, but rather in the Netscape.ini file.) Using this technique, you could easily create an INF file for Netscape 4.x or Internet Explorer 3.x or 4.x.
It's simple enough to automate the process of adding information to the registry. You start by creating a REG file, either by exporting existing information using RegEdit or by very carefully building it from scratch. To launch the REG file within a batch file, you prefix its name with Regedit /S. The /S switch tells RegEdit not to display a message box.
The earlier item referenced above, "Remove Entries from the Windows 95 Registry Automatically," explains in detail how to create INF file entries that delete entire registry keys or particular values within a key. In addition, it provides a sample INF file that deletes history lists for a large number of common applications. If this topic interests you, be sure to read that article as well.
But activating that INF file still required direct user interaction--you had to right-click it and choose Install from the pop-up menu. Now we see that it's possible to locate and copy the command invoked by that Install menu item, thereby gaining the ability to automate launching an INF file. Using carefully crafted INF files to delete keys and values and REG files to add them, you can build batch files that make important changes to the registry without ever launching the powerful (and dangerous) RegEdit program.
FIGURE 1: This sample INF file deletes the URL history for 32-bit Netscape 3.x.
;DELURL.INF
;When "installed," this file ;deletes the "URL History" key
;in the Win 95 Registry and all
;values (URLs) associated
;with it.
[version]
signature="$CHICAGO$"
[DefaultInstall]
DelReg=EraseThis
[EraseThis]
HKCU,"Software\Netscape\Netscape Navigator\URL History"
;HKCU is Win 95 shorthand for ;Hkey_Current_User
Powered by vBulletin™ Version 4.1.0 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.