Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Automatically Format Your PowerShell Table

$
0
0

Summary: Set a default preference variable and avoid typing –autosize and –wrap with Windows PowerShell 3.0.

Hey, Scripting Guy! Question How can I avoid always having to type –autosize and –wrap with the Format-Table cmdlet? I am using Windows PowerShell 3.0.

                      Hey, Scripting Guy! Answer Set the $PSDefaultParameterValues automatic variable with the appropriate default values. This can be done on a Windows PowerShell session basis or stored in your Windows PowerShell profile. Here is an example of setting the default behavior of the Format-Table cmdlet to always autosize and wrap the output.

                                 $PSDefaultParameterValues=@{"Format-Table:autosize"=$true;"Format-Table:wrap"=$true}


Viewing all articles
Browse latest Browse all 3333

Trending Articles