September 6th, 2014

PowerTip: PowerShell Tabs

Doctor Scripto
Scripter

Summary: Understand Windows PowerShell tabs.

Hey, Scripting Guy! Question How can I use Windows PowerShell to efficiently add 1, 2, or 3 tabs to a string?

Hey, Scripting Guy! Answer Use the `t character for a single tab. Use `t`t for two tabs, and multiply them for three or more (such as “`t”*3).
           Here are examples:

PS C:\> "this has a `t in it"

this has a       in it

PS C:\> "this has 2 `t`t in it"

this has 2               in it

PS C:\> "this has 3" + "`t"*3 + "in it"

this has 3                      in it

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.