Wednesday, August 10, 2016

Solution to Error: Batch file runs fine, but not when called by Schtasks

Batch file runs fine, but not when called by Schtasks

I'm trying to create an automated workflow for cyclically running a batch file (every few minutes) that concatenates a file onto PDFs and then drops the resultant files into a watched hot folder (broadcast/shared by a printing system).The batch file I wrote to do the concatenation and copying of files works fine when run manually, but when called by Schtasks, a window flashs briefly at each trigger, but disappears too fast to see what the error is.So I'm not sure whether the problem is in the batch file, or something I'm getting wrong in the Schtasks setup.Oops! I didn't make my problem clear enough.

I'm not concerned whether the batch file runs visibly, but the fact that it's failing to process anything, and I can't figure out why.Here are the files (schtasks first, then the concatenating batch file - ignore most of the rem lines) ...rem This batch file creates a scheduled task to cyclically run my ticketing batchfile

Keys to the Problem Batch file runs fine, but not when called by Schtasks

Have you checked in Task Scheduler for error info? Have you checked the properties of the created task in TS?These links might be of use in error chasinghttp://msdn.microsoft.com/en-us/library/windows/desktop/aa383614(v=vs.85).aspxhttp://technet.microsoft.com/en-us/library/cc721871.aspx- - - - - - - - -As I've not automated any TS entries, I know nothing about using a batch file to create a task. So I wonder why you are using a batch file to create a task to run a batch file. Perhaps this is simply a means of distribution that is better than manually creating the batch file on one PC then exporting it to an xml file that you then distribute to the other PCs & import into their TSs.

Check memory problems

Memory management issues can also cause a BSOD in Windows 7. Thankfully, Windows 7 has a Memory Management Diagnostic tool that detects and solves problems related to system memory.