delete Reg using .reg file

J

John

Hi,

I try to delete some registry key. I run the program on
cmd prompt as follows:
create a cmd file, inside the file, change the key
permission to administrator and grant to everyone, then
call the reg file regedit c:\temp\delreg.reg.

Inside the .reg file -
REGEDIT4

[-
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ACPI\PNP0
401]

and so on...

but it didn't work, why?

Thanks!
 
D

Dave Patrick

If you want to remove a key and all it's underlying values then you'll need
to construct your .reg file with a - minus sign in front of the key you want
to remove.

An example file to remove a file association .zzz from HKCR
-----------------Begin File-----------
Windows Registry Editor Version 5.00

[-HKEY_CLASSES_ROOT\.zzz]
----------------End File-------------

(note the minus sign in front of HKEY)


If you need to delete only certain values, for example the string value
"InfoTip"="Contains zzz files"

Then put a minus sign after the equals sign without "quotes", something like
"InfoTip"=-

So your .reg file would look like
----------------Begin File------------
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.zzz]
"InfoTip"=-
----------------End File-------------

regedit /s filename.reg to import silently


--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft MVP [Windows NT/2000 Operating Systems]
Microsoft Certified Professional [Windows 2000]
http://www.microsoft.com/protect.


:
| Hi,
|
| I try to delete some registry key. I run the program on
| cmd prompt as follows:
| create a cmd file, inside the file, change the key
| permission to administrator and grant to everyone, then
| call the reg file regedit c:\temp\delreg.reg.
|
| Inside the .reg file -
| REGEDIT4
|
| [-
| HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ACPI\PNP0
| 401]
|
| and so on...
|
| but it didn't work, why?
|
| Thanks!
 
D

Dave Patrick

If you want to remove a key and all it's underlying values then you'll need
to construct your .reg file with a - minus sign in front of the key you want
to remove.

An example file to remove a file association .zzz from HKCR
-----------------Begin File-----------
Windows Registry Editor Version 5.00

[-HKEY_CLASSES_ROOT\.zzz]
----------------End File-------------

(note the minus sign in front of HKEY)


If you need to delete only certain values, for example the string value
"InfoTip"="Contains zzz files"

Then put a minus sign after the equals sign without "quotes", something like
"InfoTip"=-

So your .reg file would look like
----------------Begin File------------
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.zzz]
"InfoTip"=-
----------------End File-------------

regedit /s filename.reg to import silently


--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft MVP [Windows NT/2000 Operating Systems]
Microsoft Certified Professional [Windows 2000]
http://www.microsoft.com/protect.


:
| Hi,
|
| I try to delete some registry key. I run the program on
| cmd prompt as follows:
| create a cmd file, inside the file, change the key
| permission to administrator and grant to everyone, then
| call the reg file regedit c:\temp\delreg.reg.
|
| Inside the .reg file -
| REGEDIT4
|
| [-
| HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ACPI\PNP0
| 401]
|
| and so on...
|
| but it didn't work, why?
|
| Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top