当前powershell的环境配置
PS C:\Users\Administrator> Get-ExecutionPolicy
RemoteSigned
同一个脚本文件abc.ps1,直接运行没问题,使用C++通过system调用执行,就会报错。求高手解答
C++ code:
int _tmain(int argc, _TCHAR* argv[])
{
system(“abc.ps1”);
return 0;
}
执行的结果提示:
无法加载文件 E:\MyToolCode\powershell\build\test\abc.ps1,因为在此系统中禁止执行脚本。有关详细信息,
请参阅 “get-help about_signing”。
所在位置 行:1 字符: 43
+ E:\MyToolCode\pub_ver\build\pubver\abc.ps1 <<<<
+ CategoryInfo : NotSpecified: (:) [], PSSecurityException
+ FullyQualifiedErrorId : RuntimeException