Get ‘psh’ here:
What is ‘psh’?
Ever lost your PowerShell command history when closing the window, wishing it could be easily retrieved? ‘psh’ might just be the tool for you. It’s a straightforward PowerShell script designed to make retrieving and viewing your past PowerShell commands simpler than using the default Get-History command.
Key Features of ‘psh’
‘psh’ introduces several enhancements to make viewing your PowerShell history more accessible:
- Selective History Viewing: Control how many of the most recent commands you want to see, making browsing your command history straightforward.
- Optional Timestamps: If you need to know when each command was executed, ‘psh’ can append timestamps next to each command.
- Error Messages: Should something go wrong, ‘psh’ provides clear error messages to help you quickly identify and fix issues.
- Help Parameter: Unsure how to use any part of ‘psh’? The -Help parameter offers instructions right in your command window.
Getting Started with ‘psh’
Using ‘psh’ is easy:
- Download the psh.ps1 script file and save it to a convenient location.
- Open a PowerShell window and navigate to the directory where you saved the psh.ps1.
- Run the script by inputting
.\psh.ps1
followed by any parameters you might need. Here are a few examples:
- View the last 10 commands:
.\psh.ps1 10
- View 50 recent commands with timestamps:
.\psh.ps1 50 -s
Parameters Explained
- -t , -TailLines : Sets the number of commands to display.
- -s, -ShowTimestamps: Activates the display of timestamps next to each command.
- -d , -DateFormat : Alters the format of the displayed timestamps.
- -h, -Help: Provides helpful information about using the script.
Conclusion
‘psh’ is an invaluable script for anyone who frequently uses PowerShell and seeks an effortless way to access past commands. While it doesn’t replace more complex tools, it offers a straightforward solution to a common problem. To try ‘psh’ for yourself, visit the GitHub page and follow the setup instructions for an enhanced PowerShell experience with minimal effort.