Windows Powershell方法(对象能做什么)
方法定义了一个对象可以做什么事情。当你把一个对象输出在控制台时,它的属性可能会被转换成可视的文本。但是它的方法却不可见。列出一个对象的所有方法可是使用Get-Member命令,给“MemeberType”参数传入“Method”:
PSC:Powershell>$Host|Get-Member-MemberTypeMethod
TypeName:System.Management.Automation.Internal.Host.InternalHost
Name MemberTypeDefinition ---- -------------------- EnterNestedPrompt Method System.VoidEnterNestedPrompt() Equals Method boolEquals(System.Objectobj) ExitNestedPrompt Method System.VoidExitNestedPrompt() GetHashCode Method intGetHashCode() GetType Method typeGetType() NotifyBeginApplication Method System.VoidNotifyBeginApplication() NotifyEndApplication Method System.VoidNotifyEndApplication() PopRunspace Method System.VoidPopRunspace() PushRunspace Method System.VoidPushRunspace(runspacerunspace) SetShouldExit Method System.VoidSetShouldExit(intexitCode) ToString Method stringToString()