PowerShell Logo Small

Clear-History



This is the built-in help made by Microsoft for the command 'Clear-History', in PowerShell version 3 - as retrieved from Windows version 'Microsoft Windows Server 2012 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Deletes entries from the command history.

SYNTAX


Clear-History [[-Id] <Int32[]>] [[-Count] <Int32>] [-Newest] [-Confirm] [-WhatIf] [<CommonParameters>]
Clear-History [[-Count] <Int32>] [-CommandLine <String[]>] [-Newest] [-Confirm] [-WhatIf] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Clear-History cmdlet deletes commands from the command history, that is, the list of commands entered during the current session.


Without parameters, Clear-History deletes all commands from the session history, but you can use the parameters of Clear-History to delete
selected commands.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/?LinkID=135199
Add-History
Get-History
Invoke-History
about_History

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

PS C:\>clear-history



Deletes all commands from the session history.








-------------------------- EXAMPLE 2 --------------------------

PS C:\>clear-history -id 23, 25



Deletes the commands with history IDs 23 and 25.








-------------------------- EXAMPLE 3 --------------------------

PS C:\>clear-history -command *help*, *command



Deletes commands that include "help" or end in "command".








-------------------------- EXAMPLE 4 --------------------------

PS C:\>clear-history -count 10 -newest



Deletes the 10 newest commands from the history.








-------------------------- EXAMPLE 5 --------------------------

PS C:\>clear-history -id 10 -count 3



Deletes the three oldest commands, beginning with the entry with ID 10.