我发现这段代码可以为 powershell 创建简单的输入框:
[void][Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic')
$title = 'Demographics'
$msg = 'Enter your demographics:'
$text = [Microsoft.VisualBasic.Interaction]::InputBox($msg, $title)
Run Code Online (Sandbox Code Playgroud)
有谁知道如何添加更多输入字段?
WPF、XAML、.NET 和 ShowUI 都是您可用的选项。
此外,您还可以使用 Visual Studio 社区版(免费)或付费工具,例如https://poshgui.com/
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
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6096 次 |
| 最近记录: |