PowerShell formatting is somewhat complex and can be confusing at first. In fact, there are only a few basic rules:
In $PSHOME
, there are files whose names end with format.ps1xml
. These files are XML files that specify the default formatting specifications for many of the types of objects that you will work with in PowerShell. These files are loaded by the host when the PowerShell session starts. If you write your own format files, you can load them using the Update-FormatData
cmdlet. The details of writing your own format files are beyond the scope of this book, but a quick read through the FileSystem.Format.ps1xml
file will make some things clear:
In this file, first, we can see that the formatting is selected...