reg query batch script
PostPosted:Fri Mar 25, 2011 10:16 pm
I've been trying to create this batch file to query the services keys.
First I collected all services into a text file.
The first output "match not found" so the other entries do not print to text file.
I found this:
Is it possible to use %KEY_NAME% like CSS for html, using a list of keys to check?
First I collected all services into a text file.
Code: Select all
Then I append to the front "reg query" and to the end " /t REG_MULTI_SZ > C:\Users\thissystem\Desktop\dependson.txt, save as .bat. C:\>reg query HKLM\SYSTEM\CurrentControlSet\Services\ >c:\Users\thissystem\Deskto
p\services.txt
The first output "match not found" so the other entries do not print to text file.
I found this:
Code: Select all
http://stackoverflow.com/questions/4451 ... tch-script@echo OFF
setlocal ENABLEEXTENSIONS
set KEY_NAME="HKEY_CURRENT_USER\Software\Microsoft\Command Processor"
set VALUE_NAME=DefaultColor
FOR /F "usebackq skip=4 tokens=1-3" %%A IN (`REG QUERY %KEY_NAME% /v %VALUE_NAME% 2^>nul`) DO (
set ValueName=%%A
set ValueType=%%B
set ValueValue=%%C
)
if defined ValueName (
@echo Value Name = %ValueName%
@echo Value Type = %ValueType%
@echo Value Value = %ValueValue%
) else (
@echo %KEY_NAME%\%VALUE_NAME% not found.
)
Is it possible to use %KEY_NAME% like CSS for html, using a list of keys to check?