19

Since updating to Windows 10 v1809, pressing Shift+Space no longer sends a space in Powershell v5. If I use an older Windows 10 station (v1709), Shift+Space sends a space.

For example, I'm accustomed to pressing the following sequence of keys:

g, c, i, Shift+Space, |.

In v1803, this would result with gci |. In v1809, the result is gci|.

Is this key combination conflicting with something recently introduced? The problem is reproducible on multiple stations. If I'm working in a text editor, the problem doesn't exist. Launching PS with -NoProfile has no impact.

Additionally, this has only affected my installation of PS 5.1. In my installation of PS Core 6.0.2, Shift+Space still sends a space.

2
  • 1
    this thread could be the fix reddit.com/r/sysadmin/comments/9n9mh0/…
    – SimonS
    Oct 11, 2018 at 14:32
  • This resolved the problem. If you post the steps from the original reddit post as an answer, I'll be happy to accept as the answer.
    – root
    Oct 11, 2018 at 15:59

2 Answers 2

18

It seems like you need to update the PowerShellGet and PSReadLine Module to make shift+space work again.

  1. Open PowerShell as admin
  2. Run install-module -name powershellget -force
  3. Restart PowerShell (as admin)
  4. Run install-module -name psreadline -allowprerelease -force
  5. Restart PowerShell again

This should do it and it should work again.

Source: https://www.reddit.com/r/sysadmin/comments/9n9mh0/powershell_51_shiftspace_problem/

6
  • This worked for me. Feb 14, 2019 at 23:31
  • 1
    This worked for me as well. I didn't have to reinstall powershellget and I was able to install it only for the current user with the -User flag. (Also, I don't have a -AllowPrerelease parameter for Install-Module. Not sure if that's related to the powershellget install, but it worked fine without as of today.) Jul 2, 2019 at 12:37
  • Yep, upgrading to 2.0.0 beta4 fixed it for me
    – Jaykul
    Jul 17, 2019 at 19:03
  • The second install-module failed here with insufficient privileges. Yes, I'm a local administrator. Yes, I was running in an elevated Powershell. No matter, though, as I've got my shift-space sequence back, thank you.
    – roaima
    Jan 22, 2020 at 23:30
  • Thank you, this has been annoying me for months because I very regularly am accidentally holding shift when I press space in prep to add a pipe! For me, even running as admin, I also had to add -scope CurrentUser to get the psreadline to install, but its working perfectly after that.
    – Panomosh
    Feb 7, 2020 at 9:08
10

This seems to be "broken" again in PowerShell 5.1.x. That is, Get-PSReadLineKeyHandler shows no mapping associated with Shift+Spacebar, and pressing shift+space has no effect whatsoever.

Explicitly enabling it with Set-PSReadLineKeyHandler -Chord Shift+Spacebar -Function SelfInsert fixes the issue (pressing shift+space inserts space character), but the mapping will not show in the Get-PSReadLineKeyHandler listing as is, but as plain Space mapping.

1
  • Upvoted this as it seems to be a (ahem) "better" fix than installing pre-release versions of modules
    – Kepboy
    Jun 17, 2021 at 23:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.