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"

原文地址:https://www.cnblogs.com/dreamer-fish/p/3935547.html