在powershell中将空格转换为参数

时间:2016-06-20 21:29:08

标签: powershell-v3.0 invoke-command

$ arglist =" / p:stuff = "Release|x64" / P:InstallerStuff = "Release|x64" / P:InstallerLanguages = "en-US""

$ cmd =" ./ create.cmd"

invoke-expression $ cmd $ arglist

失败,因为arglist中有空格,我如何编码或转义空格,以便将它们传递给cmd脚本?

1 个答案:

答案 0 :(得分:0)

$ args = $ arglist.split('') invoke-expression $ cmd $ args [0] $ args [1] $ args [2]