Skip to content

Instantly share code, notes, and snippets.

@vpetruchok
Created July 10, 2017 07:49
Show Gist options
  • Save vpetruchok/0f8834c562547c19113a3d9f8b6bc882 to your computer and use it in GitHub Desktop.
Save vpetruchok/0f8834c562547c19113a3d9f8b6bc882 to your computer and use it in GitHub Desktop.
PowerShell Repl History
# from https://superuser.com/questions/880213/automatically-export-history-at-end-of-powershell-session
$HistoryFilePath = Join-Path ([Environment]::GetFolderPath('UserProfile')) .ps_history
Register-EngineEvent PowerShell.Exiting -Action { Get-History | Export-Clixml $HistoryFilePath } | out-null
if (Test-path $HistoryFilePath) { Import-Clixml $HistoryFilePath | Add-History }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment