There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
 
DOS/PDA/Other
Tag Cloud
adware audio bios blue screen boot bsod computer crash dell driver drivers dvd email error excel firefox freeze freezing google hard drive hardware hijackthis install internet laptop linux malware network no sound outlook outlook 2007 problem router screen slow sound speakers spyware startup trojan usb video virus vista vundo windows windows 7 windows vista windows xp wireless
Search
Search for:
Tech Support Guy Forums > Operating Systems > DOS/PDA/Other >
Solved: Adding Registry Entry as Decimal

Tip: Click here to scan for System Errors and Optimize PC performance
[ Sponsored Link ]

Closed Thread
 
Thread Tools
scrfix's Avatar
Computer Specs
Senior Member with 249 posts.
 
Join Date: May 2009
Experience: Computer Repair Expert
26-Jun-2009, 02:31 AM #1
Solved: Adding Registry Entry as Decimal
I am using Reg.exe.

When I add the registry entry, it stores it as a hexidecimal. In my code, I actually have a variable instead of the 123456. Is there a way to write this to store it as a decimal?

Code:
REG ADD "HKLM\Software\MyCo" /v Data /t REG_DWORD /d 123456
TheOutcaste's Avatar
Computer Specs
Distinguished Member with 5,329 posts.
 
Join Date: Aug 2007
Location: Oregon, USA
Experience: Intermediate
26-Jun-2009, 03:10 AM #2
The REG_DWORD type is a hexadecimal type. Your command does enter the decimal value. Registry Editor will show it as 0x0001e240 (123456)
A reg query will return 0x1E240 though.
If you need it displayed as a decimal number by a Reg Query, you'd need to use the REG_SZ type.

Jerry
__________________
Microsoft MVP - Windows Desktop Experience
Of course I know all the answers ; I just don't always match the answers to the right questions
Are you aware of the New Signature Limitations?
scrfix's Avatar
Computer Specs
Senior Member with 249 posts.
 
Join Date: May 2009
Experience: Computer Repair Expert
26-Jun-2009, 03:18 AM #3
Update 06-26-09
Nevermind Jerry. I figured it out. I had the Do set %var% instead of Do set var.


Old Data
Thanks Jerry.

I have one other question. I am attempting to extract that data as well for my testing but I am doing something wrong.

Code:
:: Add the registry entry 123456 to the registry
REG ADD "HKLM\Software\MyCo" /v Data /t REG_SZ /d 123456
 
:: Extract that data out and store it into %_Q%
For /F "Tokens=2*" %%a In ('Reg query "HKLM\Software\MyCo" /v Data') Do set _Q=%%b
 
:: Show me the extracted data
Echo Registry Key Data: %_Q%

Last edited by scrfix : 26-Jun-2009 03:45 AM.
TheOutcaste's Avatar
Computer Specs
Distinguished Member with 5,329 posts.
 
Join Date: Aug 2007
Location: Oregon, USA
Experience: Intermediate
26-Jun-2009, 03:51 AM #4
Your Set statement in the For loop is trying to set %_Q% instead of _Q
Code:
For /F "Tokens=2*" %%a In ('Reg query "HKLM\Software\MyCo" /v Data') Do set _Q=%%b
I use this to get data from a single reg query:
Code:
For /F "Tokens=3 skip=2" %%a In ('Reg query "HKLM\Software\MyCo" /v Data') Do set _Q=%%a
This skips the 1st two lines that reg query outputs, then directly accesses the 3rd item, which will be the value.

Jerry
Closed Thread Bookmark and Share

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Smart Search

Find your solution!



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.

Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -5. The time now is 11:31 AM.
Copyright © 1996 - 2009 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.
Powered by Cermak Technologies, Inc.