When I did $name = Read-Host 'What is your name?'
in Powershell V1 it would ask the question in a pop-up window.
With Powershell V3 it just asks in the console window. Is there a way to force Read-Host
questions to pop-up still?
When I did $name = Read-Host 'What is your name?'
in Powershell V1 it would ask the question in a pop-up window.
With Powershell V3 it just asks in the console window. Is there a way to force Read-Host
questions to pop-up still?
There are lots of ways to skin this cat. Here is one:
[void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic')
$name = [Microsoft.VisualBasic.Interaction]::InputBox("Enter your name", "Name", "$env:username")
And with the [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
and
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
assemblies, you can make a full-featured, customized input box just like you would with C#.