I wrote a batch file that uses the program curl.exe to download a database backup file. The program runs great when I run it by double clicking on it, but when I schedule the task using schtasks it won’t recognize curl.
Right away I figured it was the PATH variable so I updated the PATH variable to point to the directory curl is in and tested it by running curl from C:\. It works great from C:\ but for some reason when I run the scheduled task it launches the batch file and the batch file says “curl is not recognized as an internal or external command, operable program or batch file.”
Any idea why this would be?
From the documentation of schtasks:
/tr TaskRun : Specifies the program or command that the task runs. Type the fully qualified path and file name of an executable file, script file, or batch file. If you omit the path, SchTasks.exe assumes that the file is in the Systemroot\System32 directory.
So it does not appear to look at the path variable, even though it would appear to make the most sense.