PowerShell Logo Small

Clear-History



This is the built-in help made by Microsoft for the command 'Clear-History', in PowerShell version 2 - as retrieved from Windows version 'Microsoft® Windows Vista™ Ultimate ' 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] <int>] [-Newest] [-Confirm] [-WhatIf] [<CommonParameters>]
Clear-History [[-Count] <int>] [-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 select
ed commands.



<

RELATED LINKS

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

REMARKS

<

Examples


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

C:\PS>clear-history



Description
-----------
Deletes all commands from the session history.








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

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



Description
-----------
Deletes the commands with history IDs 23 and 25.








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

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



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








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

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



Description
-----------
Deletes the 10 newest commands from the history.








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

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



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