How can I see the command history across all PowerShell sessions in Windows Server 2016?

后端 未结 2 1934
醉梦人生
醉梦人生 2020-12-12 16:14

Where can you view the full history from all sessions in Windows Server 2016?

The following PowerShell command only includes the commands from the current session:

2条回答
  •  天涯浪人
    2020-12-12 16:37

    The Psreadline module 2.1 beta1 on Powershell gallery (Powershell 7 only) https://www.powershellgallery.com/packages/PSReadLine/2.1.0-beta1 does intellisense on the commandline using the saved history: https://github.com/PowerShell/PSReadLine/issues/1468 It's been starting to show up in Vscode. https://www.reddit.com/r/PowerShell/comments/g33503/completion_on_history_in_vscode/

    Also in Psreadline, you can search the saved history backwards with either f8 (after typing something on the command line) or control-R. Get-psreadlinekeyhandler lists the key bindings.

    get-psreadlinekeyhandler -bound -unbound | ? function -match history
    

提交回复
热议问题