I am using a batch script to delete a scheduled task, if exists on the system already.
schtasks /query /TN TestTask > C:\Users\Administrator\Documents\schtaskdel.log 2>&1
if %errorlevel%==0 (
SCHTASKS /delete /TN "TestTask " /F >C:\Users\Administrator\Documents\schtaskdel.log 2>&1
)
Now when the TestTask does not exist, I see an error in schtaskdel.log stating ERROR: The system cannot find the path specified.
Is there a way to modify this error message and add a custom message in there?
>nul schtasks /query /TN TestTask 2>&1
if %errorlevel%==0 (
SCHTASKS /delete /TN "TestTask " /F >C:\Users\Administrator\Documents\schtaskdel.log 2>&1
) ELSE echo %Your message% >C:\Users\Administrator\Documents\schtaskdel.log
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.