PowerShell常用的属性

get-location | get-member  -membertype  property

-------获取对象的属性----------

获取对象特定的成员, 湖区.Net Framwork 的原始属性和方法


PS C:Usersvol_20120330> get-location | get-member -view base


TypeName: System.Management.Automation.PathInfo

Name MemberType Definition
---- ---------- ----------
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
Drive Property System.Management.Automation.PSDriveInfo Drive {get;}
Path Property System.String Path {get;}
Provider Property System.Management.Automation.ProviderInfo Provider {...
ProviderPath Property System.String ProviderPath {get;}

格式化输出

  前面的文章中提到过部分关于格式化的内容,这里进一步进行介绍。

  PS支持4个格式化cmdlet:  format-wide、 format-list、format-table、format-custom; 这里仅介绍前面三个。

  四个命令均需要管道输出对象作为输入;四个cmdlet均有默认的输出属性,如果不进行指定,则输出默认的属性。

3、1  format-wide  

  格式化命令默认输出不同数量的属性,format-wide默认仅输出一个默认属性。

Exp:


PS C:Usersvol_20120330> get-command | format-wide

原文地址:https://www.cnblogs.com/micro-chen/p/5775830.html