1

I have a simple test.cmd script which contains one line:

echo test > log.txt

If I right click the script file and Run as Administrator, it runs fine and a log.txt file is saved in the folder.

However, when I created a task in Task Scheduler which triggers this script on a specific time, there is no log.txt saved even though everything seemed to have worked - I can see the Last Run Result as "The operation completed successfully". I tried to click the Run button in the Task Scheduler to run this task as well, and the same thing, no log.txt is generated.

How can I make this scheduled task work? Am I missing something here?

  • 2
    Did you configure an appropriate directory in the task scheduler? That is where the output will go ... – DavidPostill Feb 13 at 21:42
1

It's probably running in a different working directory. In the edit action box, where you set the cmd to run, change the "start in" box and add the directory you expect the output to be.

  • Oh I see. The log.txt is found in Windows\System32 folder. Coming from a Linux background and I found this very confusing, haha. Thank you @BlueDrink9 and @DavidPostill. – user3768495 Feb 13 at 22:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.