Documentation · Where it works

Lang Switcher in cmd, PowerShell and Windows Terminal

In Windows Terminal and the classic console, the word you just typed gets fixed, but selected text doesn’t: the only way to read a selection is to press Ctrl+C, and in a console that stops the running command.

What works

The word you just typed gets fixed both in Windows Terminal and in the classic console, the conhost window that cmd and Windows PowerShell open in unless Windows Terminal is your default terminal. The second press brings back what you typed, and capitals and spaces carry over too. A console run as administrator works the same way: here’s why.

You can type as soon as a console opens: even a word typed in the first split second gets fixed.

12:00Windows PowerShellPS C:\Users\>PauseвшкdirRUSENG12
12:00Windows PowerShellPS C:\Users\>PauseвшкdirRUSENG12
You meant dir but typed вшк → Pause: dir and the English layout; Pause again brings back вшк.

Selected text doesn’t

Text you select in a console, with the mouse or with Shift and the arrow keys, isn’t converted. The only way for the program to read a selection is to press Ctrl+C, and in a console with nothing selected, that cancels the line you’re typing and stops the running command. So in a console, the hotkey fixes only the word you’ve just typed, and without one it just switches the layout. Fix the word right after typing it, before you press Enter.

How the replacement works

  • Windows Terminal: as in any other window, the program erases the word and types the replacement.
  • The classic console: Windows PowerShell 5.1 doesn’t accept a replacement typed as characters. The word used to get erased, and the replacement never appeared. So here the program first switches the window’s layout, and then, in one batch, erases the word and presses the same keys you pressed. That way the replacement gets through in both Windows PowerShell and cmd.

When the word stays as it was

In the classic console, a word with a dead key or AltGr in it (layouts with accents have them) can’t be retyped key by key. Such a word stays as you typed it, and you hear a dull thud. Nothing gets lost.

Passwords in a console

The program doesn’t treat a password prompt in a console (ssh, sudo) as a password field. It remembers what you type there like any other word, until Enter or another word boundary. With Arabic and similar layouts, it also keeps up to 64 recent keystrokes in memory until you switch windows or stop typing for a minute. Keystrokes are never written to disk.

If you set the replacement method by hand

The program picks the replacement method for each window by itself. If the settings file says [replacement] method = "backspace", there’s nothing left to pick, and in the classic console with Windows PowerShell 5.1 the word goes missing again. Leave it at auto.

What hasn’t been tested

PowerShell 7 and other programs in the classic console are handled the same way, but I’ve only tested this in Windows PowerShell 5.1 and cmd. The refusal on a dead key or AltGr has been checked by automated tests, but not in a live console.

Questions and problemson GitHub Issues ↗ or by email: send.me@panda-pishet-kod.dev