环境配置说明
- Windows 21H1
- PSVersion 5.1.19041.1320
示例
PS C:\Users\admin> Get-Alias | Get-Member
TypeName:System.Management.Automation.AliasInfo
Name MemberType Definition
---- ---------- ----------
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ResolveParameter Method System.Management.Automation.ParameterMet...
ToString Method string ToString()
CommandType Property System.Management.Automation.CommandTypes...
Definition Property string Definition {get;}
Description Property string Description {get;set;}
Module Property psmoduleinfo Module {get;}
ModuleName Property string ModuleName {get;}
Name Property string Name {get;}
Options Property System.Management.Automation.ScopedItemOp...
OutputType Property System.Collections.ObjectModel.ReadOnlyCo...
Parameters Property System.Collections.Generic.Dictionary[str...
ParameterSets Property System.Collections.ObjectModel.ReadOnlyCo...
ReferencedCommand Property System.Management.Automation.CommandInfo ...
RemotingCapability Property System.Management.Automation.RemotingCapa...
ResolvedCommand Property System.Management.Automation.CommandInfo ...
Source Property string Source {get;}
Version Property version Version {get;}
Visibility Property System.Management.Automation.SessionState...
DisplayName ScriptProperty System.Object DisplayName {get=if ($this....
HelpUri ScriptProperty System.Object HelpUri {get=$oldProgressPr...
ResolvedCommandName ScriptProperty System.Object ResolvedCommandName {get=$t...
Get-Alias对象的属性
CommandType Property System.Management.Automation.CommandTypes...
Definition Property string Definition {get;}
Description Property string Description {get;set;}
Module Property psmoduleinfo Module {get;}
ModuleName Property string ModuleName {get;}
Name Property string Name {get;}
Options Property System.Management.Automation.ScopedItemOp...
OutputType Property System.Collections.ObjectModel.ReadOnlyCo...
Parameters Property System.Collections.Generic.Dictionary[str...
ParameterSets Property System.Collections.ObjectModel.ReadOnlyCo...
ReferencedCommand Property System.Management.Automation.CommandInfo ...
RemotingCapability Property System.Management.Automation.RemotingCapa...
ResolvedCommand Property System.Management.Automation.CommandInfo ...
Source Property string Source {get;}
Version Property version Version {get;}
Visibility Property System.Management.Automation.SessionState...
DisplayName ScriptProperty System.Object DisplayName {get=if ($this....
HelpUri ScriptProperty System.Object HelpUri {get=$oldProgressPr...
ResolvedCommandName ScriptProperty System.Object ResolvedCommandName {get=$t...
通过将Get-Alias的结果导出成csv文件的方法,可以查看到列名和Property是相互对应的。在powershell中,存在多种类型的Property,比如ScriptProperty等。
PS C:\Users\admin> Get-Alias | Export-Csv alias.csv
#TYPE System.Management.Automation.AliasInfo
"HelpUri","ResolvedCommandName","DisplayName","ReferencedCommand","ResolvedCommand","Definition","Options","Description","OutputType","Name","CommandType","Source","Version","Visibility","ModuleName","Module","RemotingCapability","Parameters","ParameterSets"
Get-Alias对象的方法
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ResolveParameter Method System.Management.Automation.ParameterMet...
ToString Method string ToString()