我试图安装多个软件,其中一些软件依赖于其他软件,这意味着它在安装其他软件之前会查找一些二进制软件。这个安装过程是在Powershell上进行的,当第一个软件安装完成时,它将在Path环境变量上附加路径位置。但它没有显示当前活动会话的更新的Path env变量,并且由于其他软件无法安装。
安装该软件之前:
PS C:\Users\webapp> $env:Path
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ProgramFiles\Pragma\Clients
安装软件后:
PS C:\Users\webapp> $env:Path
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ProgramFiles\Pragma\Clients
但它假设显示:
PS C:\Users\webapp> $env:Path
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ProgramFiles\Pragma\Clients;C:\apps-core\bin
我能够使用下面的metho
更新活动命令提示会话的Path env变量for /f "tokens=3*" %%A in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v Path') do set syspath=%%A%%B
set Path=%syspath%
但我不确定如何通过Powershell实现相同目标。