PowerShell Bash history command

Emulating Bash History Command in PowerShell

This article introduces the usage and examples of "h", which is equivalent to Linux Bash's history command in PowerShell, the Windows command line language. ForEach-Object...

Vulpes
1 min read
Nov 5, 2025

This article introduces the usage and examples of โ€œhโ€, which is equivalent to Linux Bashโ€™s history command in PowerShell, the Windows command line language.

h | ForEach-Object {$_.CommandLine}

Example:

PS C:\pg> h | ForEach-Object {$_.CommandLine} | sls "note"

notepad

Share this article

Vulpes Nov 5, 2025

๐Ÿ”— Copy Links