Format-*
Aller à la navigation
Aller à la recherche
| Fiche express | |
|---|---|
| Cmdlets | Format-List, Format-Table, Format-Wide, Format-Custom
|
| Domaine | Mise en forme de la sortie console |
| Voir aussi | Get-childitem · Get-Service |
PowerShell propose quatre cmdlets pour reformater l'affichage des objets en sortie :
Format-List ou fl
Format-Table ou ft
Format-Wide ou fw
Format-Custom ou fc
Format-List
Affiche les propriétés sous forme de liste (une propriété par ligne).
Get-ChildItem c:\ | Format-List
Get-ChildItem f: | Format-List -Property Name,Length
Get-Service | Format-List -Property Name,DisplayName,Status
Get-Service | Format-List *
Get-ChildItem config.sys | Format-List *
(Get-ChildItem config.sys).CreationTime
(Get-ChildItem .\dmocx.dll) | Format-List Name,*time
(Get-ChildItem .\dmocx.dll) | Get-Member -MemberType Method
Format-Table
Format d'affichage par défaut (tableau).
Get-ChildItem c:\ | Format-Table
# Paramètres : -Property -AutoSize -HideTableHeaders -GroupBy
Get-ChildItem c:\ | Format-Table -Property Mode,Name,Length,IsReadOnly,CreationTime,LastAccessTime,Attributes -AutoSize
Get-ChildItem c:\ | Format-Table -Property Mode,Name,Length,IsReadOnly,CreationTime,LastAccessTime -GroupBy IsReadOnly
Format-Wide
Format large, sur plusieurs colonnes.
Get-ChildItem c:\ | Format-Wide
# Paramètres : -Property -AutoSize -Column
Get-Service | Format-Wide -Property DisplayName
Get-ChildItem c:\windows | Format-Wide -AutoSize
# Sur 4 colonnes
Get-ChildItem c:\windows | Format-Wide -Column 4