php 如何启动 cmd.exe 以使用 Task Scheduler 执行命令?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28507707/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to launch cmd.exe to execute command using Task Scheduler ?
提问by Klaus Byskov Pedersen
I want to launch cmd.exeto execute command using Task Scheduler:
我想启动cmd.exe以使用Task Scheduler执行命令:
Here is my command line :
这是我的命令行:
C:\wamp\bin\php\php5.5.12\php.exe -f "C:\Inetpub\wwwroot\php\index.php"
C:\wamp\bin\php\php5.5.12\php.exe -f "C:\Inetpub\wwwroot\php\index.php"
This command will load a php.exeand run my phpscript from C:\Inetpub\wwwroot\php
此命令将加载一个php.exe并从以下位置运行我的php脚本C:\Inetpub\wwwroot\php
Here is how I set up my task scheduler :
这是我设置任务计划程序的方法:
I am not sure - what to put in the Start in Box - plus since it's (optional) so I leave it blank.
我不确定 - 在开始框中放什么 - 加上因为它是(可选)所以我把它留空。
After save the task and hit run, I got this
保存任务并点击运行后,我得到了这个
It doesn't do anything.
它什么也不做。
What did I do wrong - here ?
我做错了什么 - 在这里?
回答by Klaus Byskov Pedersen
Program should not be cmd
but C:\wamp\bin\php\php5.5.12\php.exe
and the argument should be -f "C:\Inetpub\wwwroot\php\index.php"
. You can leave Start in
blank. It refers to "current folder" from the program's perspective. It should not really matter in you current scenario.
程序不应该是cmd
但是C:\wamp\bin\php\php5.5.12\php.exe
,论点应该是-f "C:\Inetpub\wwwroot\php\index.php"
。你可以Start in
留空。从程序的角度来看,它指的是“当前文件夹”。在您当前的情况下,这并不重要。