Formatting strings in PowerShell is easy, just include the variable inside the string and it does it automatically, right? What about when you are using variable values (i.e. $ds.count)?
Then you have to write an ugly line of code like:

$string = "There are " + $ds.count + " items in the dataset"

I’m sure your thinking, ah that’s not too bad. But what if you had four or five value strings to put together? There is a better way to concatenate strings with variables values, it’s called Formatting a String. This is accomplished through .Net, and looks like:

[string]::Format("There are {0} items in the dataset",$ds.count)

And it works with more than one value:

$OutputFile = [string]::Format("{0}\{1}.xml",$OutputPath,$FileTimeStamp)

The basics of the String.Format Method is to provide an indexed set of overloads into the string. Each overload is represented by the {0} notation, where the number inside the curly bracket is the indexed location of the overload. To read more about the method, check out the MSDN Article.