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

知道这为什么不管用吗?


当前回答




我的脚本是从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

其他回答

操作:启动一个程序

程序/脚本:C:\Windows\System32\cmd.exe

添加参数:/k start "" E:\scripts\example.bat"

在批处理文件的末尾添加exit。

如果选择“运行”,无论用户是否登录,cmd窗口将不显示。您需要选择“仅当用户登录时运行”,以查看运行中的窗口。

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.

如果以上所有步骤都失败了,请确保您试图以用户身份运行任务的用户有权访问您试图使用的文件。

在我的情况下,我试图从C:\Users\Administrator\Desktop运行一个批处理文件,该帐户无法访问。将它移动到C:\的中立位置解决了这个问题。




我的脚本是从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

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