How to get ANSI output from "REG.EXE EXPORT KEY FILE"

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
alan_b
Expert
Posts: 357
Joined: 04 Oct 2008 09:49

How to get ANSI output from "REG.EXE EXPORT KEY FILE"

#1 Post by alan_b » 08 Jan 2011 06:56

I have some registry keys manually created by a registry editor in ANSI RegEdit4 mode.

I now need to make various sets of adjustments to the P.C. and each time recreate these keys and compare with the originals to see what is affected. I wish to use a script driving REG.EXE to avoid the pain of manually driving the registry editor each time, but that produces UNICODE

My existing tools do not work well comparing ANSI with UNICODE ! ! !

Is there a way of putting REG.EXE into ANSI mode ?

Is there an alternative to REG.EXE that gives Ansi

At the moment all I can envisage is using "TYPE *.reg > *.txt" to produce Ansi "duplicates" in addition to Unicode originals - feels untidy to me (my first P.C. had a 20 MegaByte HDD).

Incidentally I can do a once off conversion of the RegEdit4 files to unicode,
by I do not like all the Nuls that my tools show between characters.

Regards
Alan

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: How to get ANSI output from "REG.EXE EXPORT KEY FILE"

#2 Post by aGerman » 08 Jan 2011 08:17

Hello Alan.

Did you try to redirect REG QUERY?
Not sure if this could be an option for you.

Regards
aGerman

alan_b
Expert
Posts: 357
Joined: 04 Oct 2008 09:49

Re: How to get ANSI output from "REG.EXE EXPORT KEY FILE"

#3 Post by alan_b » 08 Jan 2011 12:07

Sorry but that option is not acceptable.

Amongst the keys of interest there are REG_BINARY values which are extremely long.
Far too long to be posted on any web-site.
The problem is indicated by this MUCH SMALLER key

Registry Export in sweet Regedit4 Ansi mode :-

Code: Select all

REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\FSPro Labs\Folder Lockbox]
"Hint"="four"
"SPECIAL"=hex:33,38,34,35,32,30,33,34,33,39,32,30,34,36,33,30,32,30,33,31,33,\
  35,32,30,33,32,33,32,32,30,34,33,33,31,32,30,33,37,33,38,34,35,32,30,33,34,\
  33,39,32,30,34,36,30,32,30,33,31,33,35,32,30,33,32,33,32,32,30,34,33,33,31,\
  32,30,33,37,32,33,34,35,00



REG.EXE EXPORT in Ugly UNICODE mode

Code: Select all

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\FSPro Labs\Folder Lockbox]
"Hint"="four"
"SPECIAL"=hex:33,38,34,35,32,30,33,34,33,39,32,30,34,36,33,30,32,30,33,31,33,\
  35,32,30,33,32,33,32,32,30,34,33,33,31,32,30,33,37,33,38,34,35,32,30,33,34,\
  33,39,32,30,34,36,30,32,30,33,31,33,35,32,30,33,32,33,32,32,30,34,33,33,31,\
  32,30,33,37,32,33,34,35,00



REG.EXE QUERY in never ending solid line of text mode and redirected to an output file
! REG.EXE VERSION 3.0

HKEY_LOCAL_MACHINE\SOFTWARE\FSPro Labs\Folder Lockbox
Hint REG_SZ four
SPECIAL REG_BINARY 3338343532303334333932303436333032303331333532303332333232303433333132303337333834353230333433393230343630323033313335323033323332323034333331323033373233343500


The reason for my special interest in a few particular registry keys :-
Regseeker cured my IconCache.db problem and I want to explore how and why.

I was a victim of the advice to delete IconCache.db so that Windows (XP Home + SP3) would rebuild it.
Many reboots and several days later and many failures of "snake oil" quality recommendations it still would not rebuild,
and restart took 20 seconds longer than it used to when all the icons were available in the cache.

Then I tried the suggestion of the Rebuild Icon button in Regseeker and as feared that seemed to fail,
BUT on reboot the IconCache.db was recreated and subsequent restarts were faster than they had ever been.
The rebuilt IconCache.db was now 2.6 MB instead of 6.4 MB.
Disaster - 90 odd icons all resorted, firstly into my desktop group or the "All User" desktop group,
and secondly within each group sorted into something alphabetic sequence.
All my favorite shortcuts were now in the last place I looked !

ERUNT TO THE RESCUE. Every day I have an automatic ERUNT backup of the registry,
and as I desperately hoped, when I restored the registry hives as they had been all the desktop locations were restored,
and the IconCache.db remained.

Regards
Alan

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: How to get ANSI output from "REG.EXE EXPORT KEY FILE"

#4 Post by aGerman » 08 Jan 2011 17:14

There is no ASCII option for reg.exe.
IMHO the easiest way is

Code: Select all

regedit /a filename.reg "HKEY_LOCAL_MACHINE\SOFTWARE\FSPro Labs\Folder Lockbox"

Regards
aGerman

alan_b
Expert
Posts: 357
Joined: 04 Oct 2008 09:49

Re: How to get ANSI output from "REG.EXE EXPORT KEY FILE"

#5 Post by alan_b » 09 Jan 2011 11:32

Many thanks, that is perfect for me.

I only knew that I could access the GUI via Start / Run / Regedit

I never knew that it could be launched from CMD.EXE.

I am a little disappointed that it does not give any clues via REGEDIT /?
But Searching for help on "Regedit /a" took me to a nice piece of humour at
http://uncyclopedia.wikia.com/wiki/Regedit

I also found that options /e give unicode export, and /s is Silent import as per
http://www.windowsitpro.com/article/tip ... iles-.aspx

Are there any other useful option switches please.

Regards and thanks
Alan

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: How to get ANSI output from "REG.EXE EXPORT KEY FILE"

#6 Post by aGerman » 09 Jan 2011 12:59

I never found a complete documentation.
This is my collection:

Code: Select all

regedit [/l:system] [/r:user] filename1
regedit [/l:system] [/r:user] /c filename2
regedit [/l:system] [/r:user] /e filename3 [regpath1]
regedit [/l:system] [/r:user] /a filename3 [regpath1]
regedit [/l:system] [/r:user] /d regpath2
regedit [/l:system] [/r:user] /s ...
regedit [/l:system] [/r:user] /v ...
regedit [/l:system] [/r:user] /m


/l:system         – location of the system.dat file
/r:user           – location of the user.dat file
        filename1 – the file to import into the registry
/c filename2      – the file to create the registry from
/e filename3      – the file to export the registry to (UNICODE)
/a filename3      – the file to export the registry to (ASCII)
        regpath1  - the starting registry key to export from
/d regpath2       - the registry key to delete
/s                - executes any command line operation quietly
/v                - executes any command line operation in advanced mode
/m                - opens an additional instance of regedit

I've heard something about an /u switch, but no idea what it is good for.

Regards
aGerman

alan_b
Expert
Posts: 357
Joined: 04 Oct 2008 09:49

Re: How to get ANSI output from "REG.EXE EXPORT KEY FILE"

#7 Post by alan_b » 09 Jan 2011 16:44

Thank you for that list.
That will keep me entertained for a while ! !

Regards
Alan

Post Reply