Powershell V1 v V3 – popup窗口消失了

当我做了$name = Read-Host 'What is your name?' 在Powershell V1中,它会在popup窗口中提出问题。

使用Powershell V3,它只是在控制台窗口中询问。 有没有办法强制Read-Host问题仍然popup?

有很多方法来剥皮这只猫。 这里是一个:

 [void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') $name = [Microsoft.VisualBasic.Interaction]::InputBox("Enter your name", "Name", "$env:username") 

并与[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")程序集,您可以就像使用C#一样,创build一个function齐全的自定义input框。