A set of PowerShell scripts to persist your command history in a single, searchable file and keep your history clean.
This system has two main parts that work together: one that saves and cleans up your history when you close PowerShell, and another that lets you search and reuse that saved history.
The Profile.ps1 script registers an action that automatically runs whenever you exit a PowerShell session. It performs two key cleanup tasks:
-
Saves History: It takes all the commands from your session and appends them to a single file: session_history.csv. When you want to find an old command, you use the iah alias. This runs the Invoke-ArchivedHistory function from Import-History.ps1, which:
-
Reads the master history from session_history.csv.
-
Filters out "noise" by removing common, low-value commands like ls, dir, exit, and history before showing you the list.
This way, the list you choose from isn't cluttered, making it much easier to find the important commands you want to reuse.
-
Profile.ps1: Configures your environment on startup and sets up the automatic history saving/cleaning process for when you exit.Place the Import-History.ps1 script in your PowerShell scripts directory (e.g., C:\Users\YourUser\Scripts).
This project is licensed under the MIT License.