Windows 2008 server task scheduler does not run .bat batch job [closed]

那年仲夏 提交于 2019-11-30 11:23:04

问题


I have a batch file on a Windows 2008 server that, when invoked from command line works fine. However, when I set a scheduled task to run this job, it does not work properly.

The task scheduler does show that that the task is getting run at regular intervals, it does not show any error. But, the batch file does not process what it is supposed to process.

Any ideas on how to fix this issue is most welcome


回答1:


Windows Server 2008 will not run any batch file with quotation marks " inside the batch file. See http://technet.microsoft.com/en-us/library/dd851678.aspx




回答2:


I had a similar problem, my .bat file wouldn't correctly execute when I had the full file path in the "Program/script" field.

"D:\path\to\file\somebat.bat" didn't execute. (with quotes)

When I put D:\path\to\file\ (without quotes) in the Start in (optional): field and somebat.bat in Program/script: field somebat.bat executed correctly.

Go figure... not exactly sure why having "D:\path\to\file\somebat.bat" in the Program/script: won't work.

Maybe someone could shed some light on that?




回答3:


In my case, I had 'Run whether user is logged on or not'. When I changed to 'Run only when user is logged on' it worked OK.




回答4:


Make sure the task is running under an account with the necessary privileges. When you run a batch script from the command-line directly, it is running under your user account, which may have different permissions than the default account used for scheduled tasks.



来源:https://stackoverflow.com/questions/5085116/windows-2008-server-task-scheduler-does-not-run-bat-batch-job

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