0
I have the following .bat file:
echo Running >>.\Logs\Inspections.log
When I have it configured for
Run only when user is logged on
the log file is updated. The cmd window also appears while it is running.
When I have it configured for
Run whether user is logged on or not
the log file is not updated.
This is the only change I make between the log file updating and not updating.
In both cases the History in Task Scheduler shows that it ran. In both cases the list of events in history are identical except for the time.
The task is configured with a "Start In" folder so the relative path in the .bat file should not matter.
[EDIT] I change the echo line to look like this:
echo %date% %time% >>"C:\Some Folder\Logs\Inspections.log"
The log file was not updated and the cmd window did not appear. However, I can see in the history that the task did run with the same events as the times that it updates the log.
Try using an absolute path instead of a relative one. – Charles Burge – 2017-09-12T20:24:41.653
my first guess would be that the account you run it under does not have 'logon as a batch job' right. See https://technet.microsoft.com/en-us/library/cc957131.aspx. (but then, you should see this [failure] in history or in event log)
– wmz – 2017-09-12T22:32:44.680