我发现这段代码可以为 powershell 创建简单的输入框:
[void][Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic')
$title = 'Demographics'
$msg = 'Enter your demographics:'
$text = [Microsoft.VisualBasic.Interaction]::InputBox($msg, $title)
有谁知道如何添加更多输入字段?
最佳答案
WPF、XAML、.NET 和 ShowUI 都是您可用的选项。
或者,这是一个使用 Show-Command
cmdlet
function askforinfo {
param (
[string]$Demographics,
[validateset(1, 2, 3)]
[string]$otherstuff
)
[pscustomobject]@{
Demographics = $Demographics
OtherStuff = $otherstuff
}
}
$result = Invoke-Expression (Show-Command askforinfo -PassThru)
$result
关于具有多个输入字段的 Powershell 输入框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37555109/