20

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.

root
  • 3,672
  • 7
  • 27
  • 45
  • 1
    this thread could be the fix https://www.reddit.com/r/sysadmin/comments/9n9mh0/powershell_51_shiftspace_problem/ – SimonS Oct 11 '18 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 '18 at 15:59

2 Answers2

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/

SimonS
  • 8,924
  • 5
  • 28
  • 48
  • This worked for me. – Trevor Sullivan Feb 14 '19 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.) – Soren Bjornstad Jul 02 '19 at 12:37
  • Yep, upgrading to 2.0.0 beta4 fixed it for me – Jaykul Jul 17 '19 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 '20 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 07 '20 at 09:08
  • I fixed this by only upgrading PSReadLine. – splattered bits Jul 08 '22 at 19:51
11

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.

huoneusto
  • 211
  • 2
  • 4
  • Upvoted this as it seems to be a (ahem) "better" fix than installing pre-release versions of modules – Kepboy Jun 17 '21 at 23:46