PowerTip: Automatically Format Your PowerShell Table

Doctor Scripto

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.



Discussion is closed.

Feedback usabilla icon