Solved

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

Posted on 2011-02-21
5
1,373 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

Don't lose your head updating email signatures!

Do your end users still have the wrong email signature? Do email signature updates bore you or fill you with a sense of dread? You can make this a whole lot easier on yourself by trusting an Exclaimer email signature management solution. Over 50 million users do...so should you!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
In this article, I will show you HOW TO: Perform a Physical to Virtual (P2V) Conversion the easy way from a computer backup (image).
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

919 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

18 Experts available now in Live!

Get 1:1 Help Now