我有一个批处理文件daily.bat,这是代码:

cd C:\inetpub\wwwroot\infoweb\factuur\cron
c:\PHP\php.exe -f ./cron_pdf.php
ftp -s:ftp_upload.txt ftp.site.be

我在Windows 7中用任务调度程序创建了一个任务。当我手动运行批处理时,一切正常,但当我尝试用任务调度程序运行它时,什么也没有发生。

我的行动是

'run script' "C:\inetpub\wwwroot\site\x\cron\daily.bat"

UAC关闭,我是管理员。

知道这为什么不管用吗?


当前回答

Please check which user account you use to execute our task. It may happen that you run your task with different user then your default user, and this user requires some extra privileges. Also it may happen that the task is executed but you cant see any effect because the batch file waits for some user response so please check task manager if you see your process running. Once it happen that I schedule a batch with svn update of some web page and the process hangs because svn asked for accepting server certificate.

其他回答

我把这个问题的答案贴在这里和这里。

确保“开始”没有引号。

使用任务调度器主窗口中的运行按钮测试几个变体,最终找到正确的设置。这两个选项必须结合起来: -仅当用户登录时执行 -以最高权限运行。 所有其他变体都失败了。把时间浪费在这上面很让人生气,但至少它是有效的。 操作系统:Windows 8核心(基础)版本

我遇到了同样的问题,但我找到了另一个解决方案,而无需修改批处理脚本。

我唯一错过的是在“操作”设置-“开始(可选)”选项。

进入任务属性——>动作选项卡——>编辑——>按如下方式填写:

操作:启动一个程序 程序/脚本:批处理脚本的路径,例如C:\Users\beruk\bodo.bat 添加参数(可选):<如果需要-取决于你的脚本> 起始位置(可选):将完整路径放到您的批处理脚本位置,例如C:\Users\beruk\(不要在起始位置周围加上引号)

然后单击“确定”

这对我很管用。好运!

确保“Start In”不以反斜杠结尾。