Showing results for 
Search instead for 
Did you mean: 

DOS batch procedure

Jose Mosquera
Honored Contributor

DOS batch procedure

Hi guys,

I need help to script this in DOS batch syntax. First I need obtain any registry data entry into the root key HKEY_LOCAL_MACHINE where the string is present:

C:\>scanreg -s -d lm|find "Data"
Data : ",,"
Data : ","
Data : ""

So I need catch on-the-fly this output and extract second field separated by ":" and then execute to each string line the following command:
regfind -r ","

In other words, the follwing executions will be done:
regedit ",," -r ","
regedit "," -r ","
regedit "" -r ","

Ivan Ferreira
Honored Contributor

Re: DOS batch procedure

For this kind of jobs, as you are an HP-UX expert, probably you will find unxtools very usefull:

They work very whell.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Robert Gralak
Occasional Visitor

Re: DOS batch procedure

Hi Jose!

I think it will be a good, one-line solution:


@FOR /F "usebackq tokens=2* delims=:" %%a IN ('scanreg -s -d lm|find "Data"') do regedit %%a -r ","

For searching any other strings, ie.:

reg_srch ","

@FOR /F "usebackq tokens=2* delims=:" %%a IN ('scanreg -s %2 -d lm|find "Data"') do regedit %%a -r %1

Best regards