|I'm having an issue with this batch file running through Task Scheduler.|
The problem is that when the scheduled task runs it does everything except the last part. It will not copy and Task Scheduler returns (0x2) as the result.
However, when I run the batch file manually, it processes the whole file successfully. The copy works...??? The task is set to run under administrator...
Copy of my batch file:
if exist D:\Torrents\_MKV_Results.txt del D:\Torrents\_MKV_Results.txt
if exist D:\Torrents\_MKV_Results2.txt del D:\Torrents\_MKV_Results2.txt
sqlcmd -S ENCODER\SQLEXPRESS -d DEFAULT -E -i D:\Torrents\_CHK.sql -o D:\Torrents\_MKV_Results.txt -h-1
CHOICE /T:4 /D:y
for /F "tokens=*" %%a in (D:\Torrents\_MKV_Results2.txt) do C:\StaxRip\StaxRip.exe D:\Torrents\Done\%%a.mkv -encode -exit
for /f "tokens=*" %%2 in (D:\Torrents\_MKV_Results2.txt) do Copy D:\Torrents\Done\%%2.mp4 Z:\