How can I change the WindowTitle of the Read-Host prompt in the PowerShell ISE?

Question:

I know how to change the title of the main ISE window using something like

but I’m wondering how to get access to the title of the window that pops upon a Read-Host request like:

It pops with Windows PowerShell ISE - Input as the title – and yes, I know I have my Please enter Perforce Password prompt within the window – but I’d really like to be able to customize the title – any ideas?

Answer:

You can create a custom prompt with multiple choices using System.Management.Automation.Host.ChoiceDescription

This will produce a similar UI that you get with -confirm or -whatif, but you can specify the responses you want. This will work in any PowerShell Host, ISE or PowerShell.exe.

Source:

How can I change the WindowTitle of the Read-Host prompt in the PowerShell ISE? by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply