Pushes formatting to the current session.
Push-FormatData pushes formatting data into the current session.
The formatting data is defined in .Format.ps1xml files (such as those in the $pshome directory). Add-FormatData will take one or more XML documents containing format data and will create a temporary module to use the formatting file.
# Let's start off by looking at how something like XML is rendered in PowerShell
[xml]"<a an='anattribute'><b d='attribute'><c/></b></a>"
Write-FormatView -TypeName “System.Xml.XmlNode” -Wrap -Property “Xml” -VirtualProperty @{ “Xml” = { $strWrite = New-Object IO.StringWriter ([xml]$_.Outerxml).Save($strWrite) “$strWrite” } } | Out-FormatData | Push-FormatData
Clear-FormatData
The Format XML Document. The XML document can be supplied directly, but it’s easier to use Write-FormatView to create it
Type | Required | Position | PipelineInput |
---|---|---|---|
[XmlDocument] |
true | 1 | true (ByValue) |
The name of the format module. If the name is not provided, the name of the module will be the first type name encountered. If no typename is encountered, the name of the module will be FormatModuleN, where N is the number of modules loaded so far
Type | Required | Position | PipelineInput |
---|---|---|---|
[String] |
false | 2 | false |
If set, the module that contains the format files will be outputted to the pipeline
Type | Required | Position | PipelineInput |
---|---|---|---|
[Switch] |
false | named | false |
Add-FormatData [-FormatXml] <XmlDocument> [[-Name] <String>] [-PassThru] [<CommonParameters>]