使用 Windows 任务计划程序运行批处理文件 [英] Run a batch file with Windows task scheduler

查看:56
本文介绍了使用 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:

  1. 操作:启动程序
  2. 程序/脚本:批处理脚本的路径,例如C:Userserukodo.bat
  3. 添加参数(可选):<如有必要 - 取决于您的脚本>
  4. 开始(可选):输入批处理脚本位置的完整路径,例如C:Userseruk(不要在 Start In 周围加上引号)
  1. Action: Start a program
  2. Program/script: path to your batch script e.g. C:Userserukodo.bat
  3. Add arguments (optional): <if necessary - depending on your script>
  4. 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!

这篇关于使用 Windows 任务计划程序运行批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆