|
Answer» Hello,
I am trying to have this batch file check the presence of registry entries. I do not want it to print anything to the screen. If the value is present I want it to print to a text file.
reg query hkcu\software\sample if errorlevel=0 echo "hkcu\software\sample">>list.txt
That is what I have so far.
Any advice would be greatly appreciated.If all you want in your output file is "hkcu\software\sample" then you're all SET and you don't EVEN need the reg utility!
I suspect you want the result of the query in your output file:
Code: [Select]reg query "hkcu\software\sample" >> list.txt
Hope this helps. 8-)
Not even sure the reg utility assigns errorlevels.
I do not want the results printed. errorlevel 0 MEANS that it FOUND the reg key and errorlevel 1 means the key is missing. It the key exists, I want the name of the key printed in the text file.
Right now what I listed gives me what I want but TOO MUCH - is there a way I can have the result of the query not printed to the screen or a file but still ACCESS the errorlevel? The results of the query are printed to the screen but that clutters the screen.Code: [Select]reg query hkcu\software\sample > nul if errorlevel 0 echo "hkcu\software\sample">>list.txt
8-)YES that works!!! I knew I was missing something small.
Thanks!!!!!!!!!
|