Powershell - Format-Wide Cmdlet


Advertisements

cmdlet

Format-Wide cmdlet can be used to formats the output as a table with one property per object.

In these examples, we're see the Format-Wide cmdlet in action.

Example 1

In this example, first we've a file test.txt in D:\temp\test with content "Welcome to TutorialsPoint.Com" and test1.txt with content "Hello World!" and "Welcome to TutorialsPoint.Com" in two lines.

Get the file details in a variable.

$A = Get-ChildItem D:\temp\test\*.txt

Get the file details using Format-Wide cmdlet.

Format-Wide -InputObject $A

Output

You can see following output in PowerShell console.

Directory: D:\temp\test
   test.txt                                 test1.txt           

Example 2

Get the required property.

Type the following command in PowerShell ISE Console

Format-Wide -InputObject $A -Property -Property Length

Output

You can see following output in PowerShell console.

Directory: D:\temp\test
   31                                       44
powershell_advanced_cmdlets.htm
Advertisements