Displaying Input Box

by Jun 19, 2018

If you’d like to open a quick and dirty input box to prompt a user for some data, you could access Microsoft Visual Basic and “borrow” its InputBox:

Add-Type -AssemblyName Microsoft.VisualBasic
$result = [Microsoft.VisualBasic.Interaction]::InputBox("Enter your Name", "Name", $env:username)
$result

Note though that this approach has some limitations: the input box may open behind your PowerShell window, and on high resolution screens, it may not scale correctly.

Twitter This Tip! ReTweet this Tip!