Automating the world one-liner at a time…
In my blog entry regarding Cascading Type Casts ( http://blogs.msdn.com/powershell/archive/2006/07/15/Cascading_Type_Casts.aspx ) there was an example:
PS> [string][char][int][char]"PowerShell" P o w e r S h e l l
And in a comment was a question asking why there were spaces between the letters. The answer is $OFS
PSMDTAG:FAQ: What is $OFS
$OFS is a special variable that contains the string to be used as the Ouptut Field Sperator. This string is used when an array is converted to a string. By default, this is " " but you can change it.
Here are some examples to clarify:
PS> $a="1","2","3","4"PS> $a1234PS> [string]$a1 2 3 4PS> $OFS="";[string]$a1234PS> $OFS=",";[string]$a1,2,3,4PS> $OFS="--PowerShellRocks--";[string]$a1--PowerShellRocks--2--PowerShellRocks--3--PowerShellRocks--4PS> $OFS="`n`n";[string]$a1
Experiment and Enjoy!
Jeffrey Snover [MSFT]Windows PowerShell/Aspen ArchitectVisit the Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShellVisit the Windows PowerShell ScriptCenter at: http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx
PingBack from http://chrisfederico.wordpress.com/2009/05/05/powershell-using-ofs/