?
Solved

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

Posted on 2011-02-21
5
Medium Priority
?
1,386 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 2000 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

Optimum High-Definition Video Viewing and Control

The ATEN VM0404HA 4x4 4K HDMI Matrix Switch supports 4K resolutions of UHD (3840 x 2160) and DCI (4096 x 2160) with refresh rates of 30 Hz (4:4:4) and 60 Hz (4:2:0). It is ideal for applications where the routing of 4K digital signals is required.

Question has a verified solution.

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

In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
Suggested Courses

801 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