I use current Windows 10 with Powershell 5.1. Often, I want to look up commands I have used in the past to modify and/or re-run them. Inevitably, the commands I'm looking for were run in a previous or different PowerShell window/session.
When I hammer the ↑ key, I can browse through many, many commands from many, many sessions, but when I try to search through them using Get-History | Where-Object {$_.CommandLine -Like "*docker cp*"}
, I get no results. Basic troubleshooting reveals that Get-History
doesn't show anything from previous sessions, as shown by:
C:\Users\Me> Get-History
Id CommandLine
-- -----------
1 Get-History | Where-Object {$_.CommandLine -Like "*docker cp*"}
How can I search through the previous commands that the ↑ key provides using Get-History
or another Cmdlet?