snippetbashTip
Clear-History — Delete entries from the PowerShell session command history. Note: `clhy` can be used as an alias for
Viewed 0 times
thedeletecommandfromclipowershellentriesclear-history
windows
Problem
How to use the
Clear-History command: Delete entries from the PowerShell session command history. Note: clhy can be used as an alias for Clear-History. More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/clear-history>.Solution
Clear-History — Delete entries from the PowerShell session command history. Note: clhy can be used as an alias for Clear-History. More information: <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/clear-history>.Clear all command history from current session:
Clear-HistoryClear command by specific name:
Clear-History -CommandLine "{{command}}"Clear multiple commands by name:
Clear-History -CommandLine {{"command1", "command2", ...}}Clear a specific history entry by ID:
Clear-History -Id {{id_number}}Clear multiple IDs:
Clear-History -Id {{id1, id2, ...}}Clear commands within a range of IDs:
Clear-History -Id ({{start_id}}..{{end_id}})Show what would be deleted:
Clear-History -WhatIfAsk for confirmation before clearing:
Clear-History -ConfirmCode Snippets
Clear all command history from current session
Clear-HistoryClear command by specific name
Clear-History -CommandLine "{{command}}"Clear multiple commands by name
Clear-History -CommandLine {{"command1", "command2", ...}}Clear a specific history entry by ID
Clear-History -Id {{id_number}}Clear multiple IDs
Clear-History -Id {{id1, id2, ...}}Context
tldr-pages: windows/Clear-History
Revisions (0)
No revisions yet.