【发布时间】:2016-02-17 10:06:30
【问题描述】:
我在 NSIS 安装程序中使用 Powershell 来运行一些需要执行的脚本。大多数答案都会告诉使用类似的东西:
nsExec::ExecToStack 'powershell -inputformat none -ExecutionPolicy RemoteSigned -File "file1.ps1"'
此解决方案的问题在于它依赖于 Windows 中的路径变量。如果没有在路径中设置 Powershell,则永远不会执行 Powershell。
有没有更好更可靠的方法来确保即使没有设置路径变量也能执行 Powershell?
Powershell 的安装路径是(据我所知) C:\Windows\System32\WindowsPowerShell\v1.0
这可以用来在没有路径变量的情况下可靠地打开 Powershell 吗?还是可以通过某种方式从注册表中读取路径?
【问题讨论】:
标签: windows powershell path registry nsis