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
schtasks /Create /IT /SC DAILY /TN "AutoTicket Task" /TR %APP_HOME%TicketAllPDFs_HF.bat /RI 1 /DU 0:3 /SD 1/1/2012
rem @echo off
rem TicketAllPDFs_HF.bat can process any printready file dropped in a watched folder
rem by concatenating the named Job Ticket with each (wild-carded) file found
rem & moving it to ..\Done (this could be changed to the Erase command).
rem Change values for Job Ticket file, and printer\queue UNC as required ...
rem (from 1page_grayscale.xpf, and
rem The 3 lines below change to the execution drive/directory & create working folder(s)
rem named HF (& Done) if required, into which the ticketed PDFs are put.
%~d0 > TicketAllPDFs_HF.log
cd \Temp\Schtasks > TicketAllPDFs_HF.log
rem cd %~p0
rem mkdir HF
mkdir Done > TicketAllPDFs_HF.log
cd HF > TicketAllPDFs_HF.log
rem cd "%~dp0HF"
for %%I in (*.pdf) do copy/b "%~dp01page_grayscale.xpf" + "%%I" "\\220.127.116.11\DDtest\%%I" && move %%I %~dp0Done > TicketAllPDFs_HF.log
rem for %%I in (*.pdf) do copy/b "%~dp01page_grayscale.xpf" + "%%I" "%~dp0HF\%%I" >nul
rem Above command runs in quiet mode.
Rem out & unRem below commands to watch execution.
rem for %%I in (*.pdf) do copy/b "%~dp01page_grayscale.xpf" + "%%I" "%~dp0HF\%%I"
rem @echo Check that all source files appear to have been processed, then ...
Cheers, and thanks in advance, DD
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 chasing
- - - - - - - - -
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.
- Click on the Start button on the Taskbar.
- Type "Windows Memory Diagnostic Tool" or "Memory" (without quotes) in the Search box or,
- Click on Windows Memory Diagnostic Tool (in the search results).
- Click on "Restart now and check for problems (Recommended)".
- The system will restart, and you need to follow the instructions given on the screen.
Recommended Method to Fix the Problem: Batch file runs fine, but not when called by Schtasks:
How to Fix Batch file runs fine, but not when called by Schtasks with SmartPCFixer?
1. Click the button to download SmartPCFixer . Install it on your computer. Open it, and it will perform a scan for your computer. The junk files will be shown in the scan result.
2. After the scan is done, you can see the errors and problems need to be repaired. Click Fix All.
3. The Fixing part is finished, the speed of your computer will be much higher than before and the errors have been fixed.
Related: Autologon and AutoLogonCount Parameters for Windows Unattended Setup Error Fixer,How To Resolve Cyberbit Unicode Font Does Not Return Correct Charset Problem,How To Use the Office Profile Wizard to Create an OPS File in Office XP Error Fixer,Error Sys Msg 22 Invalid period, please reenter. in MC in 4.x Solution,Why am I Getting a Upgrades from 3.01 to 3.60 or 3.01 to 3.70 Involving Serial Numbers and Revaluations Are Overstating the Valuation Entries on the Purchases Error?,How Can I Fix - Error 16389?,How to Fix - Internetopen?,Mcafee Virus Scan Online,How Can I Fix - Qos Packet Scheduler Failed?,Solution to Problem: Windows 2000 Boot Repair,How to Fix ashoutxt.dll Not Found Error,Best Method to Fix cxcore096.dll Error,Where can I Find dsauth.dll File,msde.dll Corrupted - How to Resolve,psizewizres.dll Corrupted - How to Fix,How to Download ASUS XGI Compatible Super VGA Driver Package Version R1.13.00/Driver Version 18.104.22.1680 for Windows XP 32/64 bit(WHQL),Windows Server 2003 32/64 bit(WHQL),Windows Vista 32/64 bit(WHQL),Windows Server 2008 32/64 bit(WHQL),Windows 7 32/64 bit(WHQL),Window,Download NeoMagic® MagicMedia 256AVP Display Adapter Driver,Download NVIDIA RIVA TNT2 Model 64,How to Update Realtek ALC850 AC'97 Driver V22.214.171.12400 WHQL for Windows 2000/XP/2003 & 64bit XP/2003.,How to Update Realtek LAN V6.203.0214.2008,Microsoft.PowerShell.GraphicalHost.dll Error Code Fixer
,Fix Error Code Netapi32 (4).dll
,Qa_auth_client.dll Error Code Fixer
,Fix Error Code Tdc (3).ocx
,Vwipxspx.dll Error Code Fixer
,Way to Download Toshiba Qosmio X505-Q832 Intel Wireless LAN Driver v.126.96.36.199.0.s64_wCAT,Download Toshiba Satellite C650D-ST6N02 Assist Utility v.188.8.131.52 driver,How Can You Update & Download Toshiba Satellite L645-S4026RD Value Added Package v.1.6.0130.640202 driver,Method to Download Toshiba Satellite L755-S9511D Assist Utility v.184.108.40.206 driver,Method to Download Toshiba Satellite P875-S7200 Fingerprint Utility v.2.0.0001.000408 driver,Best Way to Download NVidia GeForce 6100 VGA Driver v.304.51 Certified,How Can You Update & Download NVidia GeForce 9300/nForce 730i VGA Driver v.310.19 Certified,Method to Download NVidia GeForce GT 330M Driver v.340.65,How Can I Update & Download NVidia GeForce GTX 590 Driver v.280.26 WHQL,Method to Download NVidia Tesla C2050 Driver v.319.17
Read More: How to Fix Problem - BCCode 9f (Minidump included). Windows 7 x64?,Troubleshoot:Base System driver not installed causing computer performance to be very low Error,Troubleshooting:Bitcomet Port Error,How Can You Fix - Bad Pool Header crashes?,Troubleshooter of Error: Bitlocker-Drive Error