I have scripted TstLstSR.bat to test if the last System Restore was successful, or was interrupted, or failed.
The syntax for using TstLstSR.bat is:
TstLstSR RetVal
Where RetVal is a call directed environment variable that will contain:
Y if the last System Restore was successful.
I if the last System Restore was interrupted.
N if the last System Restore failed.
NOTE: See the following tips:
How can I create a Restore Point in Windows XP, from the command-line, or from a batch?
How can I retrieve all the available Restore Points on a Windows XP Professional computer?
How can I restore a Windows XP Professional Restore Point from the command-line, or from a batch?
How can I use the command-line, or a batch, to disable Windows XP Professional System Restore on one or all drives?
TstLstSR.bat contains:
@echo off if \{%1\}==\{\} @echo Syntax: TstLstSR RetVal&goto :EOF setlocal set name=%1 set TstLstSRVBS="%TEMP%\TstLstSR_%RANDOM%.VBS" set OK=N @echo Set obj = GetObject("winmgmts:\{impersonationLevel=impersonate\}!root/default:SystemRestore")>%TstLstSRVBS% @echo status = obj.GetLastRestoreStatus()>>%TstLstSRVBS% @echo If status = 0 Then>>%TstLstSRVBS% @echo wscript.Echo "N">>%TstLstSRVBS% @echo ElseIf status = 1 Then >>%TstLstSRVBS% @echo wscript.Echo "Y">>%TstLstSRVBS% @echo ElseIf status = 2 Then>>%TstLstSRVBS% @echo wscript.Echo "I">>%TstLstSRVBS% @echo End If>>%TstLstSRVBS% for /f "Tokens=*" %%s in ('cscript //nologo %TstLstSRVBS%') do ( set OK=%%s ) del /q %TstLstSRVBS% endlocal&set %1=%OK%