I am scheduling a task that runs a CMD file on Windows 10. The file renames some files, adds the "Read only" attribute and moves them to a different folder.

When I run the CMD file outside the task scheduler (by double clicking it), it works perfectly.

When I run the scheduled task manually, I get the following message (translated from Spanish):

* Task manager finished correctly the task "\Mover a seguro", instance {(a lot of numbers and letters)}, action "C:\WINDOWS\SYSTEM32\cmd.exe" with the return code 2147942416.

General configuration:

* Use this account: (local administrator)
* Run whether the user is logged in or not
* Run with highest privileges (I also tried unchecking this one)
* Configure for Windows 10

Actions:

* Run a program: C:\Script.cmd (I also tried with C:\Script\Script.cmd)

Why doesn’t the task run correctly?