I've found this code to create simple input box for powershell:
[void][Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic')
$title = 'Demographics'
$msg = 'Enter your demographics:'
$text = [Microsoft.VisualBasic.Interaction]::InputBox($msg, $title)
Does anyone know how to add more input fields?
WPF, XAML, .NET, and ShowUI are all options available to you.
https://learn-powershell.net/2012/09/13/powershell-and-wpf-introduction-and-building-your-first-window/
http://www.show-ui.com/
also, you can use visual studio community edition (free) or a paid tool such as https://poshgui.com/
alternatively, here is an example using the 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With