Powershell menu selection (like GRUB, curses, etc.)

powershell, user-interface

Solution

You need to use the `System.Management.Automation.Host.ChoiceDescription` .NET Framework class, which is designed for console menus.

For a very good example of use, see this Technet Blog article.

EDIT: I missed the fact that you wanted an arrow keys/enter key driven CLI menu.

I found a blog post from Jakob Bindslet that seems to be just what you wanted, although I confess I can't try it just yet, but I can't wait to!

EDIT: Another excellent option from Micahel Albert can be found on his blog; I found this option to be superior in that it does not clear the console window on arrow navigation.

Problem

I want do provide the user with a menu in Powershell where he can select entities with the arrow keys just like in GRUB or just the very basic idea of curses to replace the (Y)es or (N)o command line inputs. (Or for folder selection or whatever) Is there already a framework or something that can help me as a starting point? I already checked the Out-GridView, but this leaves Powershell to another window.

Original source