command line search and replace for registry

  • Thread starter Thread starter Spacey Spade
  • Start date Start date
S

Spacey Spade

Command line search and replace for registry freeware. Is there such a
beast? In particular, I want to automate deletion of all values named
"EditFlags" in the registry.
 
Spacey said:
Command line search and replace for registry freeware. Is there such a
beast? In particular, I want to automate deletion of all values named
"EditFlags" in the registry.

Try alt.msdos.batch.nt group if can be done they know how.

Lou
 
Command line search and replace for registry freeware. Is there such a
beast? In particular, I want to automate deletion of all values named
"EditFlags" in the registry.

First: You need to be *very* sure about what you'll be doing!

And now to the name of the tool: Regfind from the Windows Server
Resource Kits should do the trick. Unfortunately, this tool isn't
part of the Server 2003 kit. And MS already removed the links for
the Server 2000 kit. I looked for Regfind with Google and came
across 2 pages which you may find handy. One is a download site:

www.petri.co.il/download_free_reskit_tools.htm

The other one provides an interesting summary of the Registry
command line tools from Microsoft:

www.chaminade.org/mis/Articles/RegistryEdit.htm

And last: You need to be *very* sure about what you'll be doing! ;-)

HTH.
BeAr
 
B. R. 'BeAr' Ederson said:
On 26 May 2006 21:45:39 -0700, Spacey Spade wrote: [snip]
In particular, I want to automate deletion of all values named
"EditFlags" in the registry.

First: You need to be *very* sure about what you'll be doing! [snip]
And last: You need to be *very* sure about what you'll be doing! ;-)

Shucks... I wasn't sure... but I have already done it manually. No
EditFlags in registry and I haven't noticed anything different in the
last week. Except perhaps that all my files get added to recent
documents list, and perhaps other useful things I haven't even noticed.
Surely you know MS is lots of bloat to enforce unecessary restrictions
(for security, of course *cough*... or was that marketing advantage?).
Ok, I have issues with MS, but not all unfounded.

Spacey
 
Ok, I have issues with MS, but not all unfounded.

The way MS does things a randomly-generated issue is probably founded
to some extent. (As you can see, I'm a MS <cough> supporter.)
 
B. R. 'BeAr' Ederson said:
And now to the name of the tool: Regfind from the Windows Server
Resource Kits should do the trick.

Error message: REGFIND: May not specify -n with -r

I can find all values that are EditFlags, but AFAIK, I can't delete'em
or rename the data to "" (only that between the quotes).
 
Error message: REGFIND: May not specify -n with -r

I can find all values that are EditFlags, but AFAIK, I can't delete'em
or rename the data to "" (only that between the quotes).

I misunderstood you. You don't want to replace values but unknown
values for known value names. This cannot be done with MS Regfind.
There is a (somewhat more complicated, but OTOH safer) workaround.

Get another Regfind utility from here:

www.intsoft.com/products/regfind

It can't replace by itself. But you can use it to get a list of key
and value pairs with your search string:

regfind -value "EditFlags" > clearEF.reg

After that, you have to convert clearEF.reg to the needed format.
Use your favorite editor with RegEx or use Sed from here:

http://unxutils.sourceforge.net

The syntax is those:

sed -i "s/^\([^ ]\+\)/[\1/;s/^ /\x22/;s/ [0-9]\{4\}\/[0-9]\{2\}\/[0-9]\{2\} [0-9]\{2\}\:[0-9]\{2\}$/]/;s/ = [^=]*$/\x22=-/;1i\REGEDIT4" clearEF.reg

or:

sed -i "s/^\([^ ]\+\)/[\1/;s/^ /\x22/;s/ [0-9]\{4\}\/[0-9]\{2\}\/[0-9]\{2\} [0-9]\{2\}\:[0-9]\{2\}$/]/;s/ = [^=]*$/\x22=\x22\x22/;1i\REGEDIT4" clearEF.reg

The first (containing the "=-" string) will delete the value, while the
second (with "=\x22\x22") will just set the value to an empty string.
Execute one of the above from an cmd prompt (which should provide a
long enough input buffer) or split your favorite one-liner to multiple
lines and run them from a batch. Splitting is done on semicolons:

sed -i "s/^\([^ ]\+\)/[\1/" clearEF.reg
sed -i "s/^ /\x22/;s/ [0-9]\{4\}\/...
:

Check the resulting clearEF.reg file for unwanted entries! (That's the
part when the "safety net" gets to work.) After that, double click on
clearEF.reg to incorporate the changes into the Registry.

Now everything should look as you like it. ;-)

BeAr
 
Back
Top