It pipes output from the .cmd script to a log file,
Are you capturing both stdout and stderr?
Configure the task to execute program cmd.exe. In the arguments field set it like this.
/c c:\scripts\myscript.cmd 1>c:\scripts\myscript.log 2>&1
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I'm trying to run a .cmd script that I've created that calls an executable created from python code that uploads to an AWS S3 bucket. I'm getting that error code. I uninstalled my intel support driver utility and I ran sfc scannow and corrected the errors, but I still get this in task scheduler. How do I fix this? It pipes output from the .cmd script to a log file, but it's empty, so that's no help. When I run the script manually by double clicking on it, it runs fine. It's being run as an administrator, too.
It pipes output from the .cmd script to a log file,
Are you capturing both stdout and stderr?
Configure the task to execute program cmd.exe. In the arguments field set it like this.
/c c:\scripts\myscript.cmd 1>c:\scripts\myscript.log 2>&1
In Start Seach type taskschd.msc and hit the Enter key.
Inside your Task Scheduler, navigate to the task that is creating the issue, right-click on it and select Properties from the context menu.
Inside the Properties screen of the task, go to the Settings tab and change the drop-down menu at the bottom of the screen to Stop the existing instance.
Click OK.
@MotoX80 I have the piping of the output happening in my script, since I determine the name of the log file using the current time and date. I do it like this. I tried what you said without the piping of the log file, but it didn't work. Like I said, it works when I double click on the .cmd file in file explorer. Thanks for the help.
Here's what my script does:
echo on
SET CURRENTTIME=%TIME%
IF "%CURRENTTIME:~0,1%"==" " (SET CURRENTTIME=0%CURRENTTIME:~1%)
FOR /F "tokens=2-4 delims=/ " %%A IN ('DATE /T') DO (SET TIMESTAMP=%%C-%%A-%%B_%CURRENTTIME%)
SET TIMESTAMP=%TIMESTAMP::=_%
SET LOGNAME="%AWS_LOG_LOCATION%System_Backup_%TIMESTAMP%.log"
echo "LOGNAME IS " %LOGNAME%
"%AWS_COPY_BACKUPS_EXECUTABLE%" -b:"F:\My Backups\New System Backup\\" -p:"[{'bucket': '%C_DRIVE_BUCKET%'},{'file_mask': 'C_VOL-.*'},{'files': 3},{'duration': 1}]" -l:"[{'boto3': 'DEBUG'}, {'botocore': 'DEBUG'}, {'aws_copy_backups': 'DEBUG'}]" -2:"[{'boto3': 'DEBUG'}, {'botocore': 'DEBUG'}, {'aws_pc_backup': 'DEBUG'}]" -t:"C:\Temp_Download\\" 1> %LOGNAME% 2>& 1
@S.Sengupta I tried that and that didn't work either. I still get the same return code. Thanks for the help.