Windows

Where Does PowerShell Store Command History?

Where PSReadLine saves command history on Windows, and the option that prints or moves the live path.

Last updated

PowerShell command history lives in ConsoleHost_history.txt under %APPDATA%\Microsoft\Windows\PowerShell\PSReadLine. Every accepted command appends there, and Up arrow plus Ctrl+R search it across sessions.

Cmdlets and native commands share the file indiscriminately, including anything typed with secrets in plain text. Clear sensitive lines with Clear-History plus a file edit, and consider Set-PSReadLineOption -HistorySaveStyle SaveNothing for vault adjacent sessions.

Where PowerShell stores this, by platform

Windows
%APPDATA%\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt

Paste %APPDATA%\Microsoft\Windows\PowerShell\PSReadLine into Explorer. Confirm with (Get-PSReadLineOption).HistorySavePath. $PROFILE customizes the path persistently.

Frequently asked questions

How do I print my exact history path?

Run (Get-PSReadLineOption).HistorySavePath: it prints the file your session actually writes. Custom profiles, -NoProfile launches and older module versions all shift it. Trust that output over any documented default.

How do I move or share history across hosts?

Set-PSReadLineOption -HistorySavePath <path> (persist it in $PROFILE). Commands append on accept, and Up arrow searches incrementally. History is per host name by default: ConsoleHost, VS Code andISE keep separate files unless redirected together.

Notice an outdated path? Let us know.