Start-Process传递变量

如果$b="aa,bb"

Start-Process PowerShell.exe -Argumentlist "d:\w.ps1 $a $b $c"

Start-Process powershell.exe "d:\w.ps1 $a $b $c"

则 $b 中的 逗号 会被识别为特殊字符,在此处会自动被替换,通过 replace 方法可以保留 逗号,如下:

$b2 = $b.Replace(",","','")

Start-Process powershell.exe "d:\w.ps1 $a $b2 $c"

posted on 2014-08-25 17:57  momingliu11  阅读(836)  评论(0编辑  收藏  举报