使用 Windows 任务计划程序运行批处理文件
我有一个批处理文件daily.bat,这是代码:
I have a batch file daily.bat, this is the code:
cd C:inetpubwwwrootinfowebfactuurcron
c:PHPphp.exe -f ./cron_pdf.php
ftp -s:ftp_upload.txt ftp.site.be
我在 Windows 7 中使用任务调度程序创建了一个任务.当我手动运行批处理时,一切正常,但是当我尝试使用任务调度程序运行它时,没有任何反应.
And I created a task with task scheduler in Windows 7. When I run the batch manually, everything goes fine, but when I try to run it with the task scheduler nothing happens.
我的动作是
'run script' "C:inetpubwwwrootsitexcrondaily.bat"
UAC 已关闭,我是管理员.
UAC is off and I am Admin.
知道为什么这不起作用吗?
Any idea why this is not working?
我遇到了同样的问题,但我找到了另一个解决方案,而无需修改我的批处理脚本.
I faced the same problem, but I found another solution without having to modify my batch script.
我唯一错过的是操作"设置 - 从(可选)开始"选项.
The only thing that I missed out is at the 'Action' settings - "Start in (Optional)" option.
转到任务属性--> 操作选项卡--> 编辑--> 填写如下:
Go the task properties --> Action tab --> Edit --> Fill up as below:
- 操作:启动程序
-
程序/脚本:批处理脚本的路径,例如
C:Userserukodo.bat
- 添加参数(可选):<如有必要 - 取决于您的脚本>
-
开始(可选):输入批处理脚本位置的完整路径,例如
C:Userseruk
(不要在 Start In 周围加上引号)
- Action: Start a program
-
Program/script: path to your batch script e.g.
C:Userserukodo.bat
- Add arguments (optional): <if necessary - depending on your script>
-
Start in (optional): Put the full path to your batch script location e.g.
C:Userseruk
(Do not put quotes around Start In)
然后点击确定
它对我有用.祝你好运!
It works for me. Good Luck!