Tech Support Guy banner
Status
Not open for further replies.

Solved: Using a script to delete a registry key.

1 reading
36K views 7 replies 4 participants last post by  TheOutcaste  
#1 ·
Looking to write some kind of script to do the following every 28 days in XP Home:

1. Remove a registry key (the whole key, not just a value)
2. Automatically restart the machine for the reg change to take effect.

If anyone can help with this I would really appreciate it!

Thanks for lookin . . .
 
#2 ·
Couple of ways to do the registry edit.

You can use the reg delete command in a batch file.
reg delete HKEY_CURRENT_USER\Software\Sysinternals\BGInfo /f

You could also export the registry key that you want to delete to create a registry file. Then edit the registry file by putting a hyphen in front of the registry path but inside the brackets.
Code:
Windows Registry Editor Version 5.00

[-HKEY_CURRENT_USER\Software\Sysinternals\BGInfo]
Then to delete the key you could put this code in your batch file.
regedit.exe /s someregfile.reg

As far as rebooting the computer that is easy enough using the shutdown cmd.
shutdown -r -f
 
#4 ·
Before Techshopguy asks why it doesn't work, XP Home does not include the Schtasks.exe command line tool, you have to use the GUI.
Control Panel | Performance and Maintenance | Scheduled Tasks
or
Start | All Programs | Accessories | System Tools | Scheduled Tasks
 
Save
Status
Not open for further replies.
You have insufficient privileges to reply here.