Contact Info

Crumbtrail » Administration » Powershell » Powershell 3.0 » Clear-Content

Clear-Content - Powershell 3.0 CmdLet

ActiveXperts Network Monitor ships with integrated Powershell scripts to monitor complex network. The scripts run out of the box
Download the ActiveXperts Network Monitor FREE version now »


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

Clear-Content [-Path] <String[]> [-Credential <PSCredential>] [-Exclude <String[]>] [-Filter <String>] [-Force] [-Inclu
de <String[]>] [-Confirm] [-WhatIf] [-UseTransaction [<SwitchParameter>]] [<CommonParameters>]
Clear-Content [-Credential <PSCredential>] [-Exclude <String[]>] [-Filter <String>] [-Force] [-Include <String[]>] -Lit
eralPath <String[]> [-Confirm] [-WhatIf] [-UseTransaction [<SwitchParameter>]] [<CommonParameters>]
Clear-Content [-Stream <string>] [<CommonParameters>]

The Clear-Content cmdlet deletes the contents of an item, such as deleting the text from a file, but it does not delete
 the item. As a result, the item exists, but it is empty. Clear-Content is similar to Clear-Item, but it works on items
 with contents, instead of items with values.

In the file system, Clear-Content clears the content in a file, but does not delete the file. It has no effect on folde

Note: This custom cmdlet help file explains how the Clear-Content cmdlet works in a file system drive. For information 
about the Clear-Content cmdlet in all drives, type "Get-Help Clear-Content -Path $null" or see Clear-Content at http://