Powershell Format-* 的使用
powershell吧
全部回复
仅看楼主
level 2
残月独照 楼主
今天遇到一个奇葩问题:
out-lineoutput : The object of type "Microsoft.PowerShell.Commands.Internal.Format.FormatStartData" is not valid or not
in the correct sequence. This is likely caused by a user-specified "format-table" command which is conflicting with th
e default formatting.
+ CategoryInfo : InvalidData: (:) [out-lineoutput], InvalidOperationException
+ FullyQualifiedErrorId : ConsoleLineOutputOutOfSequencePacket,Microsoft.PowerShell.Commands.OutLineOutputCommand
Google了一下,发觉自己真相了。。
“The reason the last function gives the error is that you are outputting both
raw objects and MSH formatting information generated by format-list.”
意思就是在用 format-* 之前,要确保这个object没有被打出来过。
Echo $object
Echo $object | format-table
会失败
Echo $object | format-table
Echo $object | format-table
会成功
2016年04月21日 06点04分 1
level 2
看完楼主的帖子,我的心情竟是久久不能平复,正如老子所云:大音希声,大象希形。
2016年08月25日 12点08分 2
1