Delete registry key or value via a CMD script?

Posted by Derek on Super User See other posts from Super User or by Derek
Published on 2012-01-19T11:11:41Z Indexed on 2012/03/26 11:35 UTC
Read the original article Hit count: 186

Filed under:
|
|
|

How do I edit an already-in-production .cmd script file, in order to have the script delete a certain registry key in the Windows registry?

Firstly, is this even possible, and secondly (if that's not possible), could I create a .reg file and execute that file from with the .cmd file?

From within the .cmd script, it is not working:

del "[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\CurrentVersion\SampleKey]"

This method hasn't worked for me either:

cmd "\\networkdrive\regfiles\deleteSampleKey.reg"

Then from within the .reg file:

Windows Registry Editor Version 5.00
[
-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
]

© Super User or respective owner

Related posts about script

Related posts about registry