Contact Info

Crumbtrail » Administration » Powershell » Powershell 2.0 » Clear-Item

Clear-Item - Powershell 2.0 CmdLet

Microsoft Windows PowerShell is a command-line shell and scripting tool based on the Microsoft .NET Framework. It is designed for system administrators, engineers and developers to control and automate the administration of Windows and applications.

More than hundred command-line tools (so called "cmdlets") can be used to perform system administration tasks and Windows Management Instrumentation (WMI). These cmdlets are easy to use, with standard naming conventions and common parameters, and standard tools for piping, sorting, filtering, and formatting data and objects.


Short description
Deletes the contents of an item, but does not delete the item.

Clear-Item [-LiteralPath] <string[]> [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>] [-Force]
     [-Include <string[]>] [-Confirm] [-WhatIf] [-UseTransaction] [<CommonParameters>]
    Clear-Item [-Path] <string[]> [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>] [-Force] [-Incl
    ude <string[]>] [-Confirm] [-WhatIf] [-UseTransaction] [<CommonParameters>]

The Clear-Item cmdlet deletes the value of an item, but it does not delete the item. For example, Clear-Item can delete the value of a variable, but it does not delete the variable. The value that used to represent a cleared item is defined by each Windows PowerShell provider.  Clear-Item is similar to Clear-Content, but it works on aliases and variables, instead of files.