The PowerShell Clear-History Command on Windows 10
The PowerShell Clear-History
command seems to have no effect. According to Vimes on StackOverflow, this command works:
Remove-Item (Get-PSReadlineOption).HistorySavePath
I see that HistorySavePath
leads here:
%APPDATA%\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt
Opening this file and deleting the contents does what Clear-History
is supposed to do—and it gives me the opportunity to make notes on any commands I might have entered in the heat of the moment for future, cooler use.