Solved

Dump a binary value from a registry key from a batch file

Posted on 2011-02-21
5
1,370 Views
Last Modified: 2012-06-21
I would like to extract and dump a binary value contained with in the windows registry to a file, not in hex but in true binary using nothing more than standard tools within windows. Does anyone know how this can be done. My instructions would be contained with in a batch file.

Reg.exe can access the value but returns hex data so it is no good to redirect it to a file.

Thanks
0
Comment
Question by:Nyhl
5 Comments
 
LVL 9

Expert Comment

by:Scottyworld
ID: 34946677
Hi,
What's the registry key you are trying to retrieve?
0
 

Author Comment

by:Nyhl
ID: 34947050
In general there is no specific key, I have created a custom registry analyser for my own purposes, and my scripts support all other formats accept I am having trouble converting to plain binary for the input of one of the applications I am using. So the keys that I am interested in are all under HKCU\Software or HKLM\Software. The purpose is for remote checks on the local network machines within the company.

All on the company domain and policies have been set to allow the following commands from my account.
0
 
LVL 16

Accepted Solution

by:
sjklein42 earned 500 total points
ID: 34947428
@REM numToBin.bat
@
@set n=%1
@set bits=
@:loop
@set /A n2=n/2
@set /A b=n-n2*2
@set bits=%b%%bits%
@set /A n=n2
@if %n% GTR 0 goto loop
@echo %bits%

Open in new window


c:\temp>c:\$\lib\numToBin.bat 255
11111111

c:\temp>c:\$\lib\numToBin.bat 2554
100111111010

c:\temp>c:\$\lib\numToBin.bat 25543
110001111000111

c:\temp>c:\$\lib\numToBin.bat 255432
111110010111001000

c:\temp>c:\$\lib\numToBin.bat 2554321
1001101111100111010001

Open in new window

0
 
LVL 12

Expert Comment

by:Sommerblink
ID: 34947597
I do not have an immediately apparent "full" solution for you, but you can query registry entries via command line, using the command 'reg.exe'

From the command prompt you can do:

"reg query hklm\software /s"

You can also look at the output for 'reg query /?' which shows you many examples of refining the search to specific key types, etc.

Then I'm sure the solution would be as simple as cranking out the output from each line and entering that into the conversion script previously posted.
0
 

Author Closing Comment

by:Nyhl
ID: 34947641
Thanks, this script has been a great help, I can shift and combine the bits with set /a byte=b0>>7¦b1>>6 ....
0

Featured Post

Shouldn't all users have the same email signature?

You wouldn't let your users design their own business cards, would you? So, why do you let them design their own email signatures? Think of the damage they could be doing to your brand reputation! Choose the easy way to manage set up and add email signatures for all users.

Join & Write a Comment

A Bare Metal Image backup allows for the restore of an entire system to a similar or dissimilar hardware. They are highly useful for migrations and disaster recovery. Bare Metal Image backups support Full and Incremental backups. Differential backup…
Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now