Windows 7 Thread, Deleting registry entries with batch file in Technical; How do you do this...
This is my batch and it does not seem to want to work:
regedit /l:c:\windows\system.dat ...
-
16th May 2012, 04:15 PM #1
- Rep Power
- 0
Deleting registry entries with batch file
How do you do this...
This is my batch and it does not seem to want to work:
regedit /l:c:\windows\system.dat /r:c:\windows\user.dat /d HKEY_CURRENT_USER\Software\Adobe\Dreamweaver CS5.5
regedit /l:c:\windows\system.dat /r:c:\windows\user.dat /d HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Dreamweaver
SHUTDOWN -r -t 10
-
-
IDG Tech News
-
16th May 2012, 04:25 PM #2 Have you tried using the REG DELETE command instead?
Code:
REG DELETE KeyName [/v ValueName | /ve | /va] [/f]
KeyName [\\Machine\]FullKey
Machine Name of remote machine - omitting defaults to the current machine.
Only HKLM and HKU are available on remote machines.
FullKey ROOTKEY\SubKey
ROOTKEY [ HKLM | HKCU | HKCR | HKU | HKCC ]
SubKey The full name of a registry key under the selected ROOTKEY.
ValueName The value name, under the selected Key, to delete.
When omitted, all subkeys and values under the Key are deleted.
/ve delete the value of empty value name (Default).
/va delete all values under this key.
/f Forces the deletion without prompt.
Examples:
REG DELETE HKLM\Software\MyCo\MyApp\Timeout
Deletes the registry key Timeout and its all subkeys and values
REG DELETE \\ZODIAC\HKLM\Software\MyCo /v MTU
Deletes the registry value MTU under MyCo on ZODIAC
-
-
16th May 2012, 04:32 PM #3 regedit.exe only accepts a .reg file to make edits to the registry - where did you get that syntax?
So you could call regedit on an existing .reg file or be a bit smarter and use itself as the reg file so something like this:
Code:
REGEDIT4
; @echo OFF
; CLS
; REGEDIT.EXE /S "%~f0"
; EXIT
[-HKEY_CURRENT_USER\Software\Adobe\Dreamweaver CS5.5]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Dreamweaver]
-
-
16th May 2012, 04:45 PM #4 
Originally Posted by
sparkeh
regedit.exe only accepts a .reg file to make edits to the registry - where did you get that syntax?
Reg is command-line though. ( C:\Windows\System32\reg.exe NOT C:\Windows\regedit.exe )
- Edit: As sparkeh said, regedit only works with .reg files now. You can only use /d in 98/ME
Steve
Last edited by Steve21; 16th May 2012 at 04:48 PM.
-
-
16th May 2012, 04:55 PM #5 Batch files - Use REGEDIT to add, read or delete registry values
Removing registry entriesTo remove an entire "tree" from the registry using REGEDIT and a .REG file, just add a minus sign before the tree name:
REGEDIT4[-HKEY_CURRENT_USER\DummyTree]
will remove the entire tree "DummyTree". To remove an individual item from the registry, place the minus sign after the equal sign:
REGEDIT4[HKEY_CURRENT_USER\DummyTree]"ValueToBeRemoved"=-
will remove the individual value "ValueToBeRemoved" from "DummyTree".
This is demonstrated in the UniqueID.bat example below, a batch file that forces a new LANDesk agent ID. How to remove an individual registry key or value using *.INF files and RUNDLL is explained by Bill James.
-
-
16th May 2012, 05:43 PM #6
- Rep Power
- 0

Originally Posted by
sparkeh
regedit.exe only accepts a .reg file to make edits to the registry - where did you get that syntax?
So you could call regedit on an existing .reg file or be a bit smarter and use itself as the reg file so something like this:
Code:
REGEDIT4
; @echo OFF
; CLS
; REGEDIT.EXE /S "%~f0"
; EXIT
[-HKEY_CURRENT_USER\Software\Adobe\Dreamweaver CS5.5]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Dreamweaver]
Do i need the ; ?
-
-
16th May 2012, 05:47 PM #7
- Rep Power
- 0
also that did not work, and neither did:
REGEDIT4[-HKEY_CURRENT_USER\Software\Adobe\Dreamweaver CS5.5]
REGEDIT4[-HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Dreamweaver]
-
-
16th May 2012, 06:17 PM #8
- Rep Power
- 0
REG DELETE seems to have worked, but not for the directory with a space in it. I tired putting it in quotes but still wont delete.
-
-
16th May 2012, 06:37 PM #9 To delete the registry keys via RegEdit you need to copy-and-paste the following code into Notepad, save it as a .reg file (e.g. Adobe.reg) and then run regedit /s Adobe.reg.
Code:
Windows Registry Editor Version 5.00
[-HKEY_CURRENT_USER\Software\Adobe\Dreamweaver CS5.5]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Dreamweaver]
To delete the same registry keys via Reg.exe, you would do this...
Code:
reg delete "HKCU\Software\Adobe\Dreamweaver CS5.5" /f
reg delete HKLM\SOFTWARE\Adobe\Dreamweaver /f
Which account are you running your batch file under? If it's the SYSTEM account, there isn't any point in trying to delete the HKEY_CURRENT_USER registry key because it won't exist.
Btw, semi-colons are just comments so can be ignored if you want.
Last edited by Arthur; 16th May 2012 at 06:39 PM.
-
Thanks to Arthur from:
mac_shinobi (16th May 2012)
-
16th May 2012, 07:52 PM #10
- Rep Power
- 0
There must be something wrong with these images, because I cant get Dreamweaver CS5.5 to show up in the wmic product list
Every other adobe app shows up. When i run a 3rd party uninstall program, i can locate the UUID of the install, but any attempt to modify / repair / uninstall says "This option is only for install packages". Yet when I got to add/remove programs it can be uninstall that way.
Frustrating!
-
-
17th May 2012, 07:54 AM #11 
Originally Posted by
agarabaghi
I can't get Dreamweaver CS 5.5 to show up in the wmic product list
WMIC will only list applications installed via Windows Installer i.e. MSIs not EXEs.
Was Dreamweaver installed as part of the Creative Suite?
-
-
17th May 2012, 09:17 AM #12 
Originally Posted by
Arthur
Btw, semi-colons are just comments so can be ignored if you want.
Not entirely true.
The code I posted above is a kind of reg file/batch file in one. In reg files the ; means a comment, the batch file will ignore the ; and process the commands.
When you run regedit with that code you need the REGEDIT4 line to make it a valid reg file, however when run as a batch file it will throw an error. The CLS line simply clear the error. And you need the regedit line to actually call regedit so that really can't be ignored
-
-
17th May 2012, 10:38 PM #13 That's a neat trick.
-
-
18th May 2012, 06:48 AM #14 
Originally Posted by
sparkeh
Not entirely true.
The code I posted above is a kind of reg file/batch file in one. In reg files the ; means a comment, the batch file will ignore the ; and process the commands.
When you run regedit with that code you need the REGEDIT4 line to make it a valid reg file, however when run as a batch file it will throw an error. The CLS line simply clear the error. And you need the regedit line to actually call regedit so that really can't be ignored

Not being brilliant with batch files, how does the last bit of this line point to itself or know where itself is ??
; REGEDIT.EXE /S "%~f0"
-
-
18th May 2012, 07:23 AM #15 The %~f0 on the end expands to the fully qualified path of the .cmd/.bat file so you don't have to hard-code it in your batch file. There are lots more you can use too...
Code:
%~0 - expands %I removing any surrounding quotes (")
%~f0 - expands %I to a fully qualified path name
%~d0 - expands %I to a drive letter only
%~p0 - expands %I to a path only
%~n0 - expands %I to a file name only
%~x0 - expands %I to a file extension only
%~s0 - expanded path contains short names only
%~a0 - expands %I to file attributes of file
%~t0 - expands %I to date/time of file
%~z0 - expands %I to size of file
The modifiers can be combined to get compound results:
%~dp0 - expands %I to a drive letter and path only
%~nx0 - expands %I to a file name and extension only
%~fs0 - expands %I to a full path name with short names only
-
SHARE: 
Similar Threads
-
By glennda in forum Windows 7
Replies: 15
Last Post: 5th February 2013, 03:57 PM
-
By richrad_mills in forum Windows
Replies: 13
Last Post: 23rd June 2010, 07:24 PM
-
By cookie_monster in forum Scripts
Replies: 1
Last Post: 6th November 2009, 08:57 AM
-
By new-2-this in forum How do you do....it?
Replies: 5
Last Post: 17th July 2008, 07:57 PM
-
By sidewinder in forum Windows
Replies: 4
Last Post: 7th December 2007, 04:48 PM
Thread Information
Users Browsing this Thread
There are currently 3 users browsing this thread. (0 members and 3 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules