PowerShell: Clear Command History 🚀

By Xah Lee. Date: .

Clear Shell Command History

put this in your PowerShell Profile

function xah-clear-history {
    # .DESCRIPTION
    # clear PowerShell command history
    # ~/AppData/Roaming/Microsoft/Windows/PowerShell/PSReadLine/ConsoleHost_history.txt
    # Version 2022-01-31
    Set-Content (Get-PSReadLineOption).HistorySavePath -Value "";
}