Solved

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

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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
This article helps those who get the 0xc004d307 error when trying to rearm (reset the license) Office 2013 in a Virtual Desktop Infrastructure (VDI) and/or those trying to prep the master image for Microsoft Key Management (KMS) activation. (i.e.- C…
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…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

705 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