$Host.GetType()
调用带参数的方法
UI对象有很多实用的方法,可以通过get-member预览
PS C:Powershell> $Host.UI | Get-Member -MemberType method
TypeName: System.Management.Automation.Internal.Host.InternalHostUserInterface
Name MemberType Definition
---- ---------- ----------
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
Prompt Method System.Collections.Generic.Dictionary[string,psob
PromptForChoice Method int PromptForChoice(string caption, string messag
PromptForCredential Method System.Management.Automation.PSCredential PromptF
ReadLine Method string ReadLine()
ReadLineAsSecureString Method System.Security.SecureString ReadLineAsSecureStri
ToString Method string ToString()
Write Method System.Void Write(string value), System.Void Writ
WriteDebugLine Method System.Void WriteDebugLine(string message)
WriteErrorLine Method System.Void WriteErrorLine(string value)
WriteLine Method System.Void WriteLine(), System.Void WriteLine(Sy
WriteProgress Method System.Void WriteProgress(long sourceId, System.M
WriteVerboseLine Method System.Void WriteVerboseLine(string message)
WriteWarningLine Method System.Void WriteWarningLine(string message)
哪一个参数是必须的
从列表中筛选出一个方法,再通过Get-Member得到更多的信息。
PS C:Powershell> $info=$Host.UI | Get-Member WriteDebugLine










