我已经读过关于使用反引号转义--
,但看起来Powershell仍在不正确地评估我的参数。
这是我正在尝试的代码:
$argList = "`--pack-extension=`"C:\Users\Me\Documents\Visual Studio 2013\Projects\Chrome\Chrome\app`" `--pack-extension-key=`"C:\Users\Me\Documents\Visual Studio 2013\Projects\Chrome\app.pem`""
$path = "'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe'"
Invoke-Expression "$path $argList"
Unexpected token 'pack-extension="C:\Users\Me\Documents\Visual Studio
2013\Projects\Chrome\Chrome\app"' in expression or statement.
我做错了什么?
答案 0 :(得分:2)
$argList = @(
'--pack-extension="C:\Users\Me\Documents\Visual Studio 2013\Projects\Chrome\Chrome\app"'
'--pack-extension-key="C:\Users\Me\Documents\Visual Studio 2013\Projects\Chrome\app.pem"'
)
$path = 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe'
& $path $argList
http://edgylogic.com/blog/powershell-and-external-commands-done-right