首页 > 开发 > PowerShell > 正文

Windows Powershell 命令集 cmdlets

2020-05-30 20:15:12
字体:
来源:转载
供稿:网友

cmdlets是Powershell的内部命令,cmdlet的类型名为System.Management.Automation.CmdletInfo,包含下列属性和方法:

Name MemberType Definition
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
CommandType Property System.Management.Automation.CommandTypes CommandType {get;}
DefaultParameterSet Property System.String DefaultParameterSet {get;}
Definition Property System.String Definition {get;}
HelpFile Property System.String HelpFile {get;}
ImplementingType Property System.Type ImplementingType {get;}
Module Property System.Management.Automation.PSModuleInfo Module {get;}
ModuleName Property System.String ModuleName {get;}
Name Property System.String Name {get;}
Noun Property System.String Noun {get;}
OutputType Property System.Collections.ObjectModel.ReadOnlyCollection`1[[System.Management.Automation.PSTypeName, System.Management.Automation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]] OutputType {get;}
Parameters Property System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Management.Automation.ParameterMetadata, System.Management.Automation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]] Parameters {get;}
ParameterSets Property System.Collections.ObjectModel.ReadOnlyCollection`1[[System.Management.Automation.CommandParameterSetInfo, System.Management.Automation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]] ParameterSets {get;}
PSSnapIn Property System.Management.Automation.PSSnapInInfo PSSnapIn {get;}
Verb Property System.String Verb {get;}
Visibility Property System.Management.Automation.SessionStateEntryVisibility Visibility {get;set;}
DLL ScriptProperty System.Object DLL {get=$this.ImplementingType.Assembly.Location;}
HelpUri ScriptProperty System.Object HelpUri {get=try
{
# ok to cast CommandTypes enum to HelpCategory because string/indentifier for
# cmdlet,function,filter,alias,externalscript is identical.
# it is ok to fail for other enum values (i.e. for Application)
$helpObject = get-help -Name ($this.Name) -Category ([string]($this.CommandType)) -ErrorAction SilentlyContinue# return first non-null uri (and try not to hit any strict mode things)
if ($helpObject -eq $null) { return $null }
if ($helpObject.psobject.properties['relatedLinks'] -eq $null) { return $null }
if ($helpObject.relatedLinks.psobject.properties['navigationLink'] -eq $null) { return $null }
$helpUri = [string]$( $helpObject.relatedLinks.navigationLink | %{ if ($_.psobject.properties['uri'] -ne $null) { $_.uri } } | ?{ $_ } | select -first 1 )
return $helpUri
}
catch {};}
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表