I want to write the names of the scheduled tasks that failed (last result: 1,9 etc.) in a file.
I can write the names of all the scheduled tasks that have been created on the Windows Server 2003 :
Code: Select all
for /F "delims=, tokens=2" %%R in ('schtasks /query /fo csv /v') do call :Sub %%R
goto :eof
:Sub
FOR %%B IN (%*) DO set TaskName=%%B
echo name: %TaskName%
:eof
But, I can't show the names of the scheduled tasks that have a last result different from 0.
Do you know how I can do that, please ?