Scheduled Task on Windows Server 2008 R2: batch keeps running

喜欢而已 提交于 2019-12-12 04:53:31

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!