reg.exe output

G

Guest

i'm trying to use reg.exe to query a remote machines
registry value. I can accomplish this, but the output is
as follows...
------------------------
reg.exe version 2.0 !

\\server\hklm....blah blah
dbname SQLSERVER10
-------------------------
i would like to only get SQLSERVER10 from the output, so i
can store it in a database.

just thought i could get some ideas before i start.
Any suggestions would be greatly appreciated.

thanks in advance,
Warren
 
M

Matthias Tacke

i'm trying to use reg.exe to query a remote machines
registry value. I can accomplish this, but the output is
as follows...
------------------------
reg.exe version 2.0 !

\\server\hklm....blah blah
dbname SQLSERVER10
-------------------------
i would like to only get SQLSERVER10 from the output, so i
can store it in a database.

just thought i could get some ideas before i start.
Any suggestions would be greatly appreciated.

thanks in advance,
Warren

We normally need real output to have something to filter on.

That is difficult with blah ...

Assuming the relevant line is, with some dropped spaces:

dbname REG_SZ SQLSERVER10

@echo off
for /f "tokens=1-2,*" %%A in (
'reg-exe "yourbla here"^|find "dbname"') do set dbname=%%C
echo %dbname%

That is as close as I can get to your virtual environment.
 
G

Guest

here's what i came up with....

@echo off
set regkey="\\server10\HKlm\software\communication
center\database"
set regvalue="dbserver"
for /f "Skip=4 Tokens=3" %%a in ('REG.EXE QUERY %
regkey% /v %regvalue%') do @echo %%a
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top