2

I'd like to get history matching in powershell 7 like: when I type npm and up arrow key, it would show my last command started with the keyword npm (Ex: npm run build).

I was able to achieve this in powershell 5 here. But this is not working in 7. When I run the discussed command:

Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward

I'm getting an error like:

Update-Module: A parameter cannot be found that matches parameter name 'Key'.
Wajahath
  • 2,827
  • 2
  • 28
  • 37
  • 4
    According to the [documentation](https://learn.microsoft.com/en-us/powershell/module/psreadline/set-psreadlinekeyhandler?view=powershell-7) the parameter is called `Chord`. Use `-Chord UpArrow` in place of `-Key UpArrow`. – IInspectable Sep 25 '20 at 07:22

0 Answers0