Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
DOS/Other
Tag Cloud
access acer asus bios bsod computer crash driver drivers error ethernet excel freeze gaming hard drive hardware hdmi internet laptop malware memory missing monitor motherboard network printer problem ram registry router security slow software sound svchost.exe toshiba trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Operating Systems > DOS/Other >
Solved: Adding Registry Entry as Decimal

Reply  
Thread Tools
scrfix's Avatar
Computer Specs
Member with 337 posts.
 
Join Date: May 2009
Experience: Computer Repair Expert
26-Jun-2009, 03: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 9,048 posts.
 
Join Date: Aug 2007
Location: Oregon, USA
Experience: Intermediate
26-Jun-2009, 04: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 Expert - Consumer
Of course I know all the answers ; I just don't always match the answers to the right questions

scrfix's Avatar
Computer Specs
Member with 337 posts.
 
Join Date: May 2009
Experience: Computer Repair Expert
26-Jun-2009, 04: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 at 04:45 AM..
TheOutcaste's Avatar
Computer Specs
Distinguished Member with 9,048 posts.
 
Join Date: Aug 2007
Location: Oregon, USA
Experience: Intermediate
26-Jun-2009, 04: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
Reply

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.

Search Tech Support Guy

Find the solution to your
computer problem!




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



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 06:03 PM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.