Solved

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

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

In this article, I will show you HOW TO: Install VMware Tools for Windows on a VMware Windows virtual machine on a VMware vSphere Hypervisor 6.5 (ESXi 6.5) Host Server, using the VMware Host Client. The virtual machine has Windows Server 2016 instal…
In this article, I will show you HOW TO: Perform a Physical to Virtual (P2V) Conversion the easy way from a computer backup (image).
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
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). …

840 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