d---- 2011/12/19 17:05 ABC
d---- 2011/12/19 17:06 ABD
d---- 2011/12/19 17:06 ABE
选择属性
在显示对象结果时如果使用了像Format-Table这样的命令,ETS也不会起作用,因为Format-Table将每个属性的值转换成了文本。所以有的时候,显示那些属性最好自己指定清楚,不要把生杀大权交给ETS。
PS C:Powershell> dir | Format-Table Mode,FullName
Mode FullName
---- --------
d---- C:PowershellABC
d---- C:PowershellABD
d---- C:PowershellABE
d---- C:Powershellmyscript
-a--- C:Powershella.ccs
-a--- C:Powershella.csv
-a--- C:Powershella.html
-a--- C:Powershella.txt
-a--- C:Powershellalias
已知对象格式化
如果使用了格式化的命令,但是没有指定具体的属性(如: dir | Format-Table)。ETS将会首次大展拳脚,它会决定那些对象应当显示,那些属性应当被自动选择。ETS在做这些工作之前,首先应当弄清楚,那些对象能够被转换成文本。
PS C:Powershell> (dir)[0].GetType().FullName
System.IO.DirectoryInfo
Dir 返回一个System.IO.DirectoryInfo对象,并且包含了这个对象里面的System.IO.FileInfo对象和System.IO.DirectoryInfo子对象。这样ETS就可以去检查自己的内部记录,通过内部记录的配置,将对象转换成文本。这些内部记录为XML文件,扩展名为“.ps1xml”
PS C:Powershell> dir $PSHOME*format.ps1xml
目录: C:WindowsSystem32WindowsPowerShellv1.0
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 2009/6/11 5:24 27338 Certificate.format.ps1xml
-a--- 2009/6/11 5:24 27106 Diagnostics.Format.ps1xml
-a--- 2009/6/11 5:24 72654 DotNetTypes.format.ps1xml
-a--- 2009/6/11 5:24 24857 FileSystem.format.ps1xml
-a--- 2009/6/11 5:24 257847 Help.format.ps1xml
-a--- 2009/6/11 5:24 89703 PowerShellCore.format.ps1xml
-a--- 2009/6/11 5:24 18612 PowerShellTrace.format.ps1xml
-a--- 2009/6/11 5:24 20120 Registry.format.ps1xml










