8.2. Using the remove-item Cmdlet
The remove-item cmdlet deletes an item from a provider. Two important uses are the deletion of items (folders and files) in the file system and the deletion of items in the registry. At the risk of stating the obvious, deletions in the file system or registry can produce undesired effects.
In addition to the common parameters (covered in Chapter 6), the remove-item cmdlet supports the use of the following parameters:
path — Specifies the path of the item(s) to be removed. A positional parameter in position 1.
recurse — If present, specifies recursive interpretation of the command. Descendant items, not only child items, of the current location are removed.
force — If present, overrides restrictions such as file renaming.
include — If present, specifies items to include. The value of this parameter qualifies the value of the -path parameter.
exclude — If present, specifies items to exclude. The value of this parameter qualifies the value of the -path parameter.
filter — Specifies a filter that qualifies the value of the -path parameter.
credential — If present, specifies a credential to use to gain access to the item(s).
|
Get Professional Windows® PowerShell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.