G
Guest
I've created a batch file that will schedule a task on a list of computers.
I'v tried to add an error log that will report if there where any errors. It
alwasys reports the same error even if it fails. I'm not sure if I have the
error handling setup correct please help.
Here is the code
@Echo off
cd\
cls
Set /P Ti=Enter the time you wish job to run:
Set /p LO=Enter the location of script or program to run:
::1. Configure the path to the PS input list
Set PCList=c:\it\pc.txt
For /F "tokens=*" %%i in (%PCList%) do (Set Node=%%i) & (Call :Remote)
GOTO :EOF
:remote
at \\%Node% %ti% /interactive "%LO%"
if not errorlevel 1 goto end
echo An error occurred during
:end
echo Job completed: %node% >> c:\logs\batch.log
I'v tried to add an error log that will report if there where any errors. It
alwasys reports the same error even if it fails. I'm not sure if I have the
error handling setup correct please help.
Here is the code
@Echo off
cd\
cls
Set /P Ti=Enter the time you wish job to run:
Set /p LO=Enter the location of script or program to run:
::1. Configure the path to the PS input list
Set PCList=c:\it\pc.txt
For /F "tokens=*" %%i in (%PCList%) do (Set Node=%%i) & (Call :Remote)
GOTO :EOF
:remote
at \\%Node% %ti% /interactive "%LO%"
if not errorlevel 1 goto end
echo An error occurred during
:end
echo Job completed: %node% >> c:\logs\batch.log