ayi <t>tl;dr<br/> <br/> <br/> There are two histories to clear:<br/> <br/> PowerShell's own, invariably in-session-only history (use Clear-History to clear it)<br/> <br/> Additionally, in consoles (terminals), that of the PSReadLine module that is used for command-line editing by default in PowerShell v5+, which provides both an in-session and a persistent history (to clear the in-session history only, use [Microsoft.PowerShell.PSConsoleReadLine]::ClearHistory())<br/> <br/> Alt-F7 in PSReadLine v1.2+ performs both calls for you, but note that the persistent history is unaffected (see next point).<br/> <br/> <br/> In versions 1.2+ of PSReadLine (verify with Get-Module PSReadLine) pressing Alt+F7 performs both calls for you, and therefore fully clears the in-session history.<br/> <br/> <br/> However, it does not clear the persistent history that has accumulated up to this point, so even the cleared session's history will resurface in future sessions by default.<br/> <br/> <br/> To also clear the persistent (saved-to-a-file) history, you currently have to manually delete the underlying file (Remove-Item (Get-PSReadlineOption).HistorySavePath), as discussed below, and as wrapped by the Clear-SavedHistory function in the bottom section.<br/> <br/> <br/> GitHub issue #25933 is a proposal to implement a new cmdlet that makes deleting the persistent history (too) easier.<br/> <br/> To complement CB.'s helpful answer and JVimes's helpful answer:<br/> <br/> <br/> PowerShell's own history mechanism (Get-History, Clear-History) is host-independent, which is why - somewhat unexpectedly - you also need to clear the hosts's command history separately.<br/> <br/> <br/> As for the console host's own history feature:<br/> <br/> <br/> doskey-style history feature, before module PSReadline shipped with PowerShell (see below):<br/> <br/> There is no saved history - a history is kept onl<br/> <br/> (Réponse tronquée)</t>