Powershell Using $OFS

Hello ,

$OFS which is a special variable in powershell . OFS stands for Output field separator . You would use this to separate objects in your array for example :

 

PS H:\> $numbers = 1,2,3,4,5
PS H:\> $numbers

1
2
3
4
5

 

What if you wanted to separate these let say with a semi colon . You can use the $OFS variable..

PS H:\> $ofs = “;” ;[string]$numbers
1;2;3;4;5 

 

This could be useful lets say if your getting users out of AD to setup an e-mail in outlook .

Not to bad … :)

For More info :

http://blogs.msdn.com/powershell/archive/2006/07/15/What-is-OFS.aspx 

 

Have Fun !

Chris

About these ads