Windows 2000 Batch file [Archive] - SpeedGuide.net Broadband Community

View Full Version : Windows 2000 Batch file


DIDS
03-17-02, 11:33 AM
I just upgraded from W98SE to W2K. I use to have a Del-Reg.inf file that was setup to delete certain keys out of the registry. This is run by a .bat file. I then created a shortcut in the startup folder so each time the PC started up. It would automatically delete the keys. This setup will not work anymore in W2K. Anyone know how to get this to work under W2k? Below are samples of my INF and Bat files.


Del_reg.inf Sample:

[Version]
signature="$CHICAGO$"

[DefaultInstall]
DelReg = RegChange

[RunIt]
DelReg=RegChange

[RegChange]
HKCR,clsid\{ADBB2D80-5DFD-11D2-A00C-00104B65AAF5}\M
HKCR,clsid\{64C53720-B69E-11D2-8728-00104B141A76}\M



Mine.bat file sample:

RunDLL setupx.dll,InstallHinfSection RunIt 0 C:\Documents and Settings\Mine Batfile\Del-Reg.inf



Thank You for any assistants.

DIDS

Norm
03-18-02, 05:26 PM
There is no need to be so complicated with the use of inf files.
All you need is a bat file, and a reg file.

Here's an example of how to delete a registry key on bootup in Win2K
First, make a bat file (name it del.bat)
Second, make a reg file (name it delkey.reg)

Batch File - Named del.bat

REGEDIT -s delkey.reg

-------------------------------------------------------------------------------------------------

Registry File Named delkey.reg

REGEDIT4

[-HKEY_LOCAL_MACHINE\Software\McAfee]

Put both files in the same directory, then make a shortcut to del.bat, and put the shortcut into the Startup Group.

In the example I had the McAfee key deleted from HKLM\software.
You can delete whatever key you want using the example. Notice the - sign before the key in the reg file? It's that - sign that deletes the key, without it, the key would be created instead. The -s in del.bat is "silent mode". It will delete the key without prompting the user for permission.

You can name your reg and bat file(s) whatever you like, as long as the bat file calls the reg file using: regedit [-key], and the bat file, or a shortcut to it, is placed in the startup group. Both files don't really need to be in the same dir either, as long as the path to the reg file is added to the bat file. I tried to keep the example simple.
There may be issues with Admin rights etc, using Win2K.
I'll leave that headache to you :)