【问题标题】:I want to execute command of cmd.exe through php but in cmd it is executing but in php exec() it is not executing我想通过 php 执行 cmd.exe 的命令,但在 cmd 中它正在执行,但在 php exec() 中它没有执行
【发布时间】:2016-04-07 17:25:02
【问题描述】:

我想执行这个命令,但它不是在调度任务,而是在 cmd 中执行了同样的命令。

echo exec('schtasks /create /np /sc minute /mo 1 /tn "TestRail Background Task" /tr "\"start http://localhost/cronjob2/cronjob.php""
');

【问题讨论】:

  • 您使用的是哪个操作系统?
  • @yogesh 你得到什么错误信息?您是否以管理员身份运行? schtasks 需要具有管理员权限。
  • @AmitShah 它是 Windows
  • 是的,它是 windows7 32 位
  • @Amnon 向我显示错误数组([0] => 错误:帐户名称和安全 ID 之间没有映射。[1] => (45,4):LogonType: )

标签: php cmd command


【解决方案1】:

我通过在它执行的命令中给出 /RU system 找到了解决方案

$command = 'schtasks /create /np /sc minute /mo 1 /tn "cronjob2" /tr "\"D:\www\webroot\cronjob2\shellscript.vbs"" /RU System'; exec("$command 2>&1", $output); print_r($output);

【讨论】:

    猜你喜欢
    • 2013-07-28
    • 1970-01-01
    • 1970-01-01
    • 2019-05-04
    • 1970-01-01
    • 1970-01-01
    • 2011-08-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多