findstr on regquery command
Posted: 27 Jul 2011 06:50
i'm trying to save the output of a findstr of a registry query command into a variable within a batch file so i can do some calculations but I always have problems with for /F loops and it doesn't seem to like the way i'm doing it.
the command i'm trying to run which works is:
i want to put the output of this into a variable so i can test it and then proceed executing other commands.
Did some googling and tried to adapt other examples and came up with this which doesn't work:
Any help much appreciated
the command i'm trying to run which works is:
Code: Select all
reg query HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Excel\Security | findstr /i level
i want to put the output of this into a variable so i can test it and then proceed executing other commands.
Did some googling and tried to adapt other examples and came up with this which doesn't work:
Code: Select all
for /F "delims=" %%a in ('reg query HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Excel\Security | findstr /i level') do set var=%%a
Any help much appreciated