PHP8.1.21版本已发布
vue8.1.21版本已发布
jquery8.1.21版本已发布

调用powershell不成功

原创
2016-06-23 14:24:37 1964浏览

powershell php

PHP调用powershell指令执行不成功

    echo shell_exec('powershell echo yy'); // 会输出yy

但是如果使用file参数就不行

    echo shell_exec('powershell -file test.ps1'); // 输出空

    // test.ps1中内容为
    echo yy

------------------------------------------

各位求助~~


回复讨论(解决方案)

路径都没问题么?

路径都没问题么?

test.ps1与这个php文件在同一个目录 难道还要写上绝对路径?我try try

路径都没问题么?

powershell中加上-executionpolicy unrestricted就可以了

powershell -executionpolicy unrestricted -file test.ps1

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。