REG.EXE falls over with the key :-
"HKEY_CURRENT_USER\Software\Local AppWizard-Generated Applications"
Excerpt of my test code :-
Code: Select all
@ECHO OFF
CALL :R "HKEY_CURRENT_USER\Software\Local AppWizard-Generated Applications"
GOTO :EOF
:R
REG QUERY %1 > TT1.TXT 2> TT2.TXT
ECHO ERRORLEVEL = %ERRORLEVEL%
ECHO TT1.TXT {
TYPE TT1.TXT
ECHO }
ECHO TT2.TXT {
TYPE TT2.TXT
ECHO }
PAUSE
Consequence is :-
ERRORLEVEL = 0
TT1.TXT {
! REG.EXE VERSION 3.0
HKEY_CURRENT_USER\Software\Local AppWizard-Generated Applications
HKEY_CURRENT_USER\Software\Local AppWizard-Generated Applications\CFPLog
HKEY_CURRENT_USER\Software\Local AppWizard-Generated Applications\CFP_Setup_3.0.14.276_XP_Vista_x32
HKEY_CURRENT_USER\Software\Local AppWizard-Generated Applications\CFP_Setup_3.0.22.349_XP_Vista_x32
HKEY_CURRENT_USER\Software\Local AppWizard-Generated Applications\LaunchAp
HKEY_CURRENT_USER\Software\Local AppWizard-Generated Applications\LaunchApp
HKEY_CURRENT_USER\Software\Local AppWizard-Generated Applications\Wbutton
}
TT2.TXT {
Error: Access is denied in the key HKEY_CURRENT_USER\Software\Local AppWizard-Generated Applications\LaunchAp
Error: Access is denied in the key HKEY_CURRENT_USER\Software\Local AppWizard-Generated Applications\LaunchApp
Error: Access is denied in the key HKEY_CURRENT_USER\Software\Local AppWizard-Generated Applications\Wbutton
}
Press any key to continue . . .
i.e. REG.EXE tells me of accessible subkeys etc in the console stream, and therefore ERRORLEVEL is made zero,
even though the error stream tells me about subkeys etc to which I have no access.
My original solution was to search for the key phrase "unable to find".
That was a perfect solution for dealing with registry keys that prevented a Comodo Security upgrade, until a German tried to use it, and error/status messages are horribly different to English.
I was aware of that problem before I coded it, but decided it was no problem because I had already learnt that C:\Documents and Settings\etc etc is different in the German O.S.
and assumed all the registry keys would similarly be different - wrong assumption.
Regards
Alan