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 "";
}

PowerShell

Practical How-To

list files

list dirs

on dir

on file

Windows config

zip tar

misc


PowerShell in Depth

Programing PowerShell

Value Types

String

Variable

Boolean

Conditional

Data Structure

Loop and Iteration

Input/Output

Function

Profile and Script

Script Examples