Clear-History - PowerShell


 

Deletes entries from the command history. (Clear-History)

   

# NAME
Clear-History

# 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>]

# 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.

# PARAMETERS
-CommandLine <string[]>
Deletes commands with the specified text strings. If you enter more than one string, Clear-History deletes commands with any of the strings.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? true

-Count <int>
Clears the specified number of history entries, beginning with the oldest entry in the history.

If you use the Count and Id parameters in the same command, the cmdlet clears the number of entries specified by the Count parameter, beginning with the entry specified by the Id parameter. For example, if Count is 10 and Id is 30, Clear-History clears items 21 through 30 inclusive.

If you use the Count and CommandLine parameters in the same command, Clear-History clears the number of entries specified by the Count parameter, beginning with the entry specified by the CommandLine parameter.

Required? false
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Id <Int32[]>
Deletes commands with the specified history IDs.

To find the history ID of a command, use Get-History.

Required? false
Position? 1
Default value None
Accept pipeline input? false
Accept wildcard characters? false

-Newest [<SwitchParameter>]
Deletes the newest entries in the history. By default, Clear-History deletes the oldest entries in the history.

Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false

-Confirm [<SwitchParameter>]
Prompts you for confirmation before executing the command.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-WhatIf [<SwitchParameter>]
Describes what would happen if you executed the command without actually executing the command.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".

# INPUTS
None
You cannot pipe objects to Clear-History.

# OUTPUTS
None
This cmdlet does not generate any output.

# NOTES

The session history is a list of the commands entered during the session. You can view the history, add and delete commands, and run commands from the history. For more information, see about_History.

Deleting a command from the history does not change the history IDs of the remaining items in the command history.

# 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.

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

C:\Windows>powershell get-help Register-PSSessionConfiguration -full

ColorConsole [Version 1.7.1000] PowerShell 2.0-Export
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2014 Microsoft Corporation.

OS: Windows 10, 8.1, 8, 7, Vista / Windows Server 2016, 2012, 2008
»»»» ColorConsole








Windows-10





Windows-10

... facebook.de
... Windows-10 FAQ
... Windows-10 Info


Become a Sponsor
... Your button here?





PowerShell: Deletes entries from the command history.

HTTP: ... PS_Windows/en/Clear-History.htm
0.187
10946

Pointer Stick Neon Yellow Metallic on Windows Desktop!

 /

Windows-10 Heimnetzgruppe Passwort / Kennwort ändern, aber wie?

 /

Where can I see if Service Pack 1 is installed on my Windows 7?

 /

Windows Defender zeigt beim Downloaden Virus an und löscht es!

 /

Complete Deactivation of Grouping in Explorer List Views!

 /

Minimize Thunderbird in tray notification area (example)!

 /

Mouse Double-Click problem at Windows-10, how to resolve this?

 /

Erstellen und Verwalten von Benutzerkonten in Windows 10?

 /

Bug Fix Q-Dir blank List View on Windows 10 / 8.1!

 /

Was ist bei Lebensmitteln im Bezug auf Allergiker und INFEKTIONEN zu beachten?

 /

Löschen Sie den Suchverlauf des Datei-Explorers in Windows (10, 8.1, 7)!

 /

Change timestamps of directorys and files quickly and effectively!

 /