Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Add this to your profile to persist your command line history in PowerShell
- # Type 'bye' instead of 'exit' to quit a session, and 'checkpoint' when you want to force a save
- # without exiting the current session
- #
- ########################################################
- # History
- $MaximumHistoryCount = 31KB
- if (!(Test-Path ~\PowerShell -PathType Container))
- { New-Item ~\PowerShell -ItemType Directory
- }
- function bye
- { Get-History -Count $MaximumHistoryCount |Export-CSV ~\PowerShell\history.csv
- exit
- }
- function checkpoint
- {
- Get-History -Count $MaximumHistoryCount |Export-CSV ~\PowerShell\history.csv
- }
- if (Test-path ~\PowerShell\History.csv)
- { Import-CSV ~\PowerShell\History.csv |Add-History
- }
- ########################################################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement