我有一个批处理文件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关闭,我是管理员。

知道这为什么不管用吗?


当前回答

我摆弄了好几个小时,尝试了很多不同的建议。

我最终通过以下方法让它工作:

操作:启动一个程序 程序/脚本:C: \ scriptdir \ script.bat 添加参数(可选)script.bat 在(可选):c:\scriptdir中启动 仅在用户登录时运行 以最高权限运行 Windows Vista, Windows Server 2008

其他回答

现在起作用了。这就是我所做的。你可能不需要所有这些步骤来让它工作,但只是为了确保尝试它们:

检查计划任务的帐户参数,并确保将它们设置为无论是否有人登录到计算机都将运行 使用大多数特权/权限检查运行 请确保先进入完整路径:cd C:\inetpub\wwwroot\infoweb\factuur\cron 不要在批处理文件中使用双引号(不知道为什么,但似乎有帮助) 作为超级管理员,在命令提示符中输入“网络用户administrator /active:yes”,注销后以超级管理员身份登录,UAC关闭




我的脚本是从master中提取最新的代码并发布一个新的分支

cd D:\dev\repo
git checkout master
git pull
git branch -D my-branch
git push origin --delete my-branch
git checkout -b my-branch
git push -u origin my-branch
exit

有一个问题,我的任务没有启动,只是因为它在没有电源线的笔记本电脑上运行……在条件选项卡下,默认情况下选中该选项,以便在交流电源未连接时任务不会运行。

尝试以高权限运行任务。

在“start in folder”路径的末尾放置一个\,例如c:\temp\

我不知道为什么,但有时这对我很有效。

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.