Contact Info

Crumbtrail

ActiveXperts.com » Administration » Powershell » Powershell 1.0 » Remove-Item

Remove-Item - Powershell 1.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 »

Remove-Item

Description
Remove an item

Usage


Options


Example(s)
Delete filenames that include a dot (.)

PS C:\>remove-item C:\Docs\*.*

Delete from the current directory (*) all files with a .doc file name extension and a name that does not include "1".

PS C:\>remove-item * -include *.doc -exclude *1*

Delete a file that is both hidden and read-only.:

PS C:\>remove-item -path C:\Docs\hidden-RO-file.txt -force

Delete all of the CSV files in the current directory and all subdirectories recursively:

PS C:\>get-childitem * -include *.csv -recurse | remove-item

Because remove-item -recurse is faulty the above uses get-childitem -recurse instead.

Delete the 'demo' registry key and all of its subkeys and values:

PS C:\>remove-item hklm:\software\SS64\demo -recurse