Can the default PowerShell terminal keep a command history?

This answer applies only to older PowerShell versions. At least since ver. 5 PowerShell persists history to a file automatically

With a little bit of scripting you could set this up, even without third party software. I would recommend reading the help on Get-History, Add-History, and about_History.

As the help explains, you can use Get-History to get your current history and with a command such as Get-History | Export-CliXml C:\History.CliXml save it to a file. Following that, you could import your history using the Add-History command.

(The Add-History help file actually explains how to do this in more detail.)

I would expect that it is possible to configure your environment to perform these actions automatically, although I would question the usefulness of such a setup.


The Windows PowerShell in Windows 10 has this functionality by default.

The history file is located at AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt.