System.Text.StringBuilder

by Jun 8, 2011

I'm pretty new to powershell, and I'm working on converting one of my winbatch scripts to powershell (learning experience).   During the process, I'm doing a lot of string concatenation to build run paths with arguments etc. for the script. 

I've found out that computationally in powershell, that's an expensive operation, and I found out that I could potentially use the system.text.stringbuilder object for .Net to accomplish the same thing, but a *lot* faster. But I don't really understand how.. I want to do something like

$strRunPath = "<path to exe>"

$strRunParams = "/a /b /c " + '"' + myParamvar + '"' + " /d"

$strRunPath = $strRunPath + $strArgs

how would I do this with stringbuilder?

Thanks for any help!

David