PSHostUserInterface
can be optained in the command line of PowerShell via $host.UI
: PS> $host.UI.GetType().FullName
Prompt() | |
PromptForChoice() | |
PromptForCredential() | |
RawUI | A reference to a System.Management.Automation.Host.PSHostRawUserInterface object. |
ReadLine() | |
ReadLineAsSecureString() | |
SupportsVirtualTerminal | true if host supports VT100 like terminals |
Write() | |
WriteDebugLine() | |
WriteErrorLine() | |
WriteInformation() | |
WriteLine() | |
WriteProgress() | |
WriteVerboseLine() | |
WriteWarningLine() |
$caption = 'Data enter' $message = 'Please enter the following information:' $fieldDescriptions = [System.Management.Automation.Host.FieldDescription[]] @( [System.Management.Automation.Host.FieldDescription]::new('valOne' ), [System.Management.Automation.Host.FieldDescription]::new('valTwo' ), [System.Management.Automation.Host.FieldDescription]::new('valThree') ) $info = $host.UI.Prompt($message, $caption, $fieldDescriptions) write-host "Val one: $($info.valOne), val two: $($info.valTwo) and val three: $($info.valThree)."