Unable to read keypresses using ($host.UI.RawUI.ReadKey('NoEcho,IncludeKeyUp')).character #13267

Open
opened 2026-01-31 03:38:12 +00:00 by claunia · 0 comments
Owner

Originally created by @jameswylde on GitHub (Apr 1, 2021).

Windows Terminal version (or Windows build number)

10.0.18363.0
Latest WT and WT preview

Other Software

Powershell 7.1.3
Powershell 5.1.18362.1171

Tested on both current WT and WT Preview, same results.

Steps to reproduce

Simple TUI to demonstrate:

do
{
     Show-Menu
     $keyPress = ($host.UI.RawUI.ReadKey('NoEcho,IncludeKeyUp')).character
     switch ($keyPress)
     {
           '1' {
                Clear-Host
                functionHere
           } 'Q' {
                return
           }
     }
     pause
}
until ($keyPress -eq 'q')

Expected Behavior

Powershell to progress and ReadKey from input.

Actual Behavior

Input is detected (writes into terminal) however on enter disappears and no action is executed.

Working fine in normal PS shells (version numbers above).

Originally created by @jameswylde on GitHub (Apr 1, 2021). ### Windows Terminal version (or Windows build number) 10.0.18363.0 Latest WT and WT preview ### Other Software Powershell 7.1.3 Powershell 5.1.18362.1171 Tested on both current WT and WT Preview, same results. ### Steps to reproduce Simple TUI to demonstrate: ``` do { Show-Menu $keyPress = ($host.UI.RawUI.ReadKey('NoEcho,IncludeKeyUp')).character switch ($keyPress) { '1' { Clear-Host functionHere } 'Q' { return } } pause } until ($keyPress -eq 'q') ``` ### Expected Behavior Powershell to progress and ReadKey from input. ### Actual Behavior Input is detected (writes into terminal) however on enter disappears and no action is executed. Working fine in normal PS shells (version numbers above).
claunia added the Resolution-By-DesignNeeds-TriageNeeds-Tag-FixNeeds-Attention labels 2026-01-31 03:38:12 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#13267