问题
On Windows Server 2008 R2 I have a batch running every 5 minutes as a Scheduled Task.
The batch code calls another batch: cmd.exe /c c:\bin\ftp_send.bat
(this does a lot more than ftp).
When this batch was invoked on Windows Server 2003, it ran and stopped when done - usually less than 4 minutes. On 2008 it does not stop - status on Refresh is always 'Running'. It finally reads 'Ready' after my configuration in Settings is triggered to 'Stop the task if it runs longer than: 30 minutes'. Also under Settings, 'If the task is already running...' is set to 'Do not start a new instance'.
If I change the cmd.exe to the 64-bit version cd c:\%windir%\syswow64
it stops the task when done, but breaks some of the executables called from 'ftp_send.bat'.
If I call it direct with the 64-bit version c:\%windir%\syswow64\cmd.exe /c c:\bin\ftp_send.bat
, it doesn't break any code, but it does not let the task stop when done.
I don't know what else to try, except maybe to set 'If the task is already running...' to 'Stop the existing instance' or 'Run a new instance in parallel'.
I could set 'Stop the task if it runs longer than: 5 minutes' but I'm afraid it may not complete all the time.
Any ideas?
来源:https://stackoverflow.com/questions/26530449/scheduled-task-on-windows-server-2008-r2-batch-keeps-running