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

知道这为什么不管用吗?


当前回答

在Windows7 Pro下,我发现Arun的解决方案对我有用:我可以让它在“没有用户登录”的情况下工作,我确实选择了使用最高特权。

根据过去的经验,您必须有一个带有密码的帐户(空白密码是不好的),如果在您完成向导时程序没有提示您输入密码,请返回并编辑一些内容,直到它提示您输入密码!

这是方法,在情况下,它不清楚的工作

Action: start a program
Program/script : cmd
      (doesn't need the .exe bit!)
Add arguments:
    /c start "" "E:\Django-1.4.1\setup.bat" 

其他回答

不要在cmd/批处理文件中使用双引号 确保你进入全路径开始(可选): C: \ Necessary_file \ Reqular_task \ QDE \ cmd_practice \

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.

上述方法都不奏效。我尝试了这种方法,就像在教程中所说的那样,它起作用了。

行动:

Start a program 

程序/脚本:

cmd

添加参数:

/c start "" "E:\Django-1.4.1\setup.bat"

在Win7 Pro上为我工作过。你必须有一个有密码的账户(空密码不行)

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

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

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

确保“开始”没有引号。