@echo off
set LISTFILE=scheduledtask.txt
echo -------------------- > %LISTFILE%.log
echo %date% - %time% >> %LISTFILE%.log
echo -------------------- >> %LISTFILE%.log
for /f %%a in (%LISTFILE%) do (
echo.
echo ---------------------------------------
echo.
echo %%a
SCHTASKS /S %%a /CREATE /SC ONCE /TN "YourFolder\reboot once" /TR "shutdown -r" /sd 01/17/2020 /ST 04:00 /RU "System" /F | find "SUCCESS"
if not errorlevel 1 (
echo %%a task was scheduled >> %LISTFILE%.log
) else (
echo %%a task was NOT scheduled >> %LISTFILE%.log
)
)
pause
No comments:
Post a Comment