if I add format data to my current session via a temporary .format.ps1xml
file and then delete the temporary file, every subsequent call to Update-FormatData
will complain about a missing file.
are the only ways of stopping these complaints to restart powershell or use an ugly -ErrorAction SilentlyContinue
, or is there a way to make powershell forget the files used for testing?
edit
at first I run a script which creates a .format.ps1xml
file on the fly for a custom PSType
, adds format data using
Update-FormatData -AppendPath C:Tempf9c23d07-7711-4846-9c68-65ec861bc91d.Format.ps1xml
then deletes the no-longer-needed .format.ps1xml
temp file, and finally produces result using the custom PSType
.
from that moment on, if I use Update-FormatData
I get this error message
[PS] C:> Update-FormatData
Update-FormatData : Could not find file 'C:Tempf9c23d07-7711-4846-9c68-65ec861bc91d.Format.ps1xml'.
At line:1 char:1
+ Update-FormatData
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Update-FormatData], CommandNotFoundException
+ FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.UpdateFormatDataCommand
I would like a way to make PowerShell forget the temporary .format.ps1xml
file.
8