0
votes

I have a simple batch file set up on a 64-bit Windows Server 2008 R2. I'm trying to set it up to run under the Windows task scheduler, specifying the admin account as the user. I have no problem running the batch file manually, when logged on to the server with the same admin account. When in the Task Scheduler though, the task just Runs and hangs. Here's the code from the batch file, moving files from a mapped drive to which the admin account has access:

DEL "O:DEL "O:\Finance file\AP\Check Run Merge\*.*" /Q
copy "O:\Finance file\AP\Invoices\ADT SECURITY_549527511_2015-05-12_655.32.pdf" "O:\Finance file\AP\Check Run Merge\142000.pdf"
copy "O:\Finance file\AP\Invoices\CENTRAL DRUG SYSTEM_244658_2015-05-08_3.50.pdf" "O:\Finance file\AP\Check Run Merge\142001.pdf"
copy "O:\Finance file\AP\Invoices\DATAFLOW BUS.SYSTEMS_156290_2015-05-20_7.50.pdf" "O:\Finance file\AP\Check Run Merge\142003.pdf"
2
I you take out the contents of the batch and just replace with echo Hello Message does the Task Scheduler still hang? An idea to help understand if its a problem with the BAT or the Scheduler.miltonb
echo hello message takes forever to run too.nutsch
In that case, I suggest you edit your question to cover, Version of Windows, settings you have set in the scheduled task because its not the details of the bat.miltonb

2 Answers

1
votes

I have just run a batch file from task scheduler using the following settings for the Action on Windows 7. The main part I got wrong the first time was not running it using cmd.exe. Also adding the /c so that the cmd closes after the batch file has run (that is probably why it takes forever).

Task Scheduler Action Settings

I made my batch file write to a log file as follows so I could see that it was running:

time /t >> C:\temp\mytestlog.txt
-2
votes

just run it as a cmd.exe with the bat file as an arg. you could also short cut it and run that