On Fri, 11 Mar 2005 19:53:01 -0800, Alan Tang <(E-Mail Removed)> wrote:
>Hello:
>
>I would like compare a few registry values.
>E.G.
>HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Lsa\CrashOnAuditFail
>I would to check doe the registry value is 1 or not.
>
>Thanks!
>
>
Use REG.EXE, built into Windows XP, Windows Server 2003, and later, or installed from the Windows 2000 Support Tools on your O/S CD-ROM.
set CrashOnAuditFail=N
for /f "Tokens=1,3" %%a in ('reg query "HKLM\System\CurrentControlSet\Control\Lsa" /V CrashOnAuditFail^|Findstr /I /L /C:"CrashOnAuditFail"') do (
for /f "Tokens=2 Delims=x" %%c in ('@echo %%b') do (
set CrashOnAuditFail=%%c
)
)
if "%CrashOnAuditFail%" EQU "N" goto notfound
if "%CrashOnAuditFail%" EQU "1" goto coaf1
OR
set CrashOnAuditFail=N
for /f "Tokens=1,3" %%a in ('reg query "HKLM\System\CurrentControlSet\Control\Lsa" /V CrashOnAuditFail^|Findstr /I /L /C:"CrashOnAuditFail"') do (
set CrashOnAuditFail=%%b
)
if "%CrashOnAuditFail:~2,1%" EQU "1" goto coaf1
Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com