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?

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

1 Answer 1

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.

1
  • 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. Commented Feb 13, 2019 at 22:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .