输入banner图图片脚本导航/分类

调用powershell不成功

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