0
我要替換在該命令的路徑:串內插環境變量
$Env:PHANTOMJS_BIN='D:\michael\software\phantomjs-1.9.7-windows\phantomjs.exe'
通過該調用的輸出:
Split-Path (Get-Command phantomjs).Path
優選使用串內插,這怎麼可能在PowerShell中?
我要替換在該命令的路徑:串內插環境變量
$Env:PHANTOMJS_BIN='D:\michael\software\phantomjs-1.9.7-windows\phantomjs.exe'
通過該調用的輸出:
Split-Path (Get-Command phantomjs).Path
優選使用串內插,這怎麼可能在PowerShell中?
這取決於您是要替換當前會話還是永久變量。也是機器範圍還是爲用戶?這裏是一個設置機器永久環境變量的示例:
[Environment]::SetEnvironmentVariable("PHANTOMJS_BIN", (Split-Path (Get-Command phantomjs).Path), [EnvironmentVariableTarget]::Machine)
你對字符串插值有什麼意義?