Author Topic: running script with Windows 10 Task Scheduler  (Read 88 times)

smhodge

  • Newbie
  • *
  • Posts: 2
running script with Windows 10 Task Scheduler
« on: January 03, 2020, 11:03:54 am »
For many years I was able to use Task Scheduler to run a WinBatch script at a certain time every day, using the Task Scheduler "Action" tab to "Start a Program":

"C:\Program Files (x86)\WinBatch\System\WinBatch_HF.EXE"

with argument specifying the WinBatch script:

"D:\steve\Scripts\WinBatch\Admin\ravenDocumentsBackup.wbt"

The script in turn runs a backup program. In the last few months that no longer works. The script works just fine, the backup is done, if I run it manually from inside WinBatch Studio but from Task Scheduler the backup program is not opened and everything hangs. 

I am using Windows 10 Pro x64, all with latest updates.  Does anybody have any idea why something that worked flawlessly for many years has now stopped working? The script itself has not been changed.

Thanks, Steve




td

  • Tech Support
  • *****
  • Posts: 3150
    • WinBatch
Re: running script with Windows 10 Task Scheduler
« Reply #1 on: January 03, 2020, 12:44:57 pm »
First, look at the log file history.  It likely contains a system error that explains your problem.  Second, search for the term "task scheduler" in this forum there are multiple posts related to the topic.  One or more of them may be helpful.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

smhodge

  • Newbie
  • *
  • Posts: 2
Re: running script with Windows 10 Task Scheduler
« Reply #2 on: January 03, 2020, 05:09:59 pm »
I don't know what log file history you are referring to.  Windows?  WinBatch?  Task Scheduler? The backup program?

Task Scheduler history simply says the action was started and task is currently running.  I eventually have to kill it.

The backup program that the script runs does not run. It has a log file and there are no entries in it.  I also send an email when the script starts and that does not happen.  So it seems like WinBatch simply does not start up completely and/or does not start running the script, when run from Task Scheduler. It all works just fine when run manually from WinBatch Studio.

There is nothing obvious in Windows Event Viewer, but I don't know how to use Event Viewer.

Are there other log files?

td

  • Tech Support
  • *****
  • Posts: 3150
    • WinBatch
Re: running script with Windows 10 Task Scheduler
« Reply #3 on: January 03, 2020, 09:45:35 pm »
That the task log indicates that the task started but has nothing else in the log and combined with the fact that the script works when running as a desktop user may be very informative.  However, since you have not provided relevant information about how the task is configured or exactly how your script is starting your "backup" program, it is impossible to say much more.  But generally, when a script just hangs in the task scheduler it is because it is not written correctly to run as a task scheduler initiated task.  This results in it displaying an error message box that no one can see or dismiss because the task is not configured to be able to interact with the desktop.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade