Computing.Net > Forums > Disk Operating System > Find & Echo Reg.Value

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Find & Echo Reg.Value

Reply to Message Icon

Name: TryToLearn
Date: September 12, 2002 at 13:24:28 Pacific
OS: WinMe H. Ed.
CPU/Ram: 512MB
Comment:

I'm lost here (not at this forum but gotta Problema!)
HOW do I find, SEARCH for and then DISPLAY a specific binary-
or DWORD-value (etc.value) from within the registry and show
the results in the batch from within it runs! (sorry, get
confused Myself) I do know how do Edit (add/rem) spec. values
/keys from a batch BUT how display/ECHO them values on screen
(that of course need to be searched for 1st) ANY IDEAS could
be great! (or confusing, lol:) Please make an realistic example
else I don't get it!! (don't write some general code wich I do
NOT understand! cause I can't relate it to any. If u make great
example I actually then imidiantly then get the basic behind it,
and also much faster really much easier, OK (honest thats true!)
IsIt also possible to have ErrorLevel if found/ or not Found ?
_____________________________________________________
THANX. BatchLearning (yeh I know: rather should try learn English!)



Sponsored Link
Ads by Google

Response Number 1
Name: Secret_Doom
Date: September 13, 2002 at 10:37:52 Pacific
Reply:

Let's say you have the DWORD value named "MyValue" under the following key:

HKEY_EXAMPLE\Macrosoft

To extract the whole key to a file, you would do:

REGEDIT /E file.dat HKEY_EXAMPLE\Macrosoft

Now that you have the whole key on the file, use FIND to display only the line which contains the value:

FIND "MyValue" < file.dat

Afterwards, delete the temporary file. I recommend using a file under the %TEMP% variable (such as %TEMP%.\file.dat), I simply used file.dat to make it simpler.

That method will display the DWORD name and value, like this:

"MyValue"="string"

If you just want the value, I can do it, though it would require a more complex batch file.

-- Leonardo Pignataro - Secret_Doom --

secret_doom@hotmail.com
www.batch.hpg.com.br


0

Response Number 2
Name: Secret_Doom
Date: September 13, 2002 at 10:42:29 Pacific
Reply:

By the way, FIND will return errorlevel 0 if it finds the string, and errorlevel 1 if it doesn't. So, use it:

REGEDIT /E file.dat HKEY_EXAMPLE\Macrosoft
FIND "MyValue" < file.dat
if errorlevel=1 echo Value not found!

In this example, if the value is found it will be displayed, and if it isn't, the message "Value not found!" will be displayed. Look this other one:

REGEDIT /E file.dat HKEY_EXAMPLE\Macrosoft
type file.dat |FIND "MyValue" > file.dat
if errorlevel=1 goto notfound
goto found

And then you would have the lables :notfound and :found further on the batch script.

-- Leonardo Pignataro - Secret_Doom --

secret_doom@hotmail.com
www.batch.hpg.com.br


0

Response Number 3
Name: TryToLearn
Date: September 15, 2002 at 21:01:28 Pacific
Reply:

Thank You for U'r great help Leonardo:)


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


instal dos on a new hard ... Dos 3.2 boot disk please



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Find & Echo Reg.Value

Pass %%a in FOR as param to batch file www.computing.net/answers/dos/pass-a-in-for-as-param-to-batch-file/10730.html

random number www.computing.net/answers/dos/random-number/13596.html

Date Manipulation www.computing.net/answers/dos/date-manipulation/12278.html