This article describes how to delete a file in PowerShell. In DOS, you can use del command, Linux also has RM command, and in PowerShell use Remove-item This cmdlet can be a word easy to handle!
In PowerShell, the cmdlet that deletes the file is Remove-item. Remove-item This cmdlet has the following aliases: RI, RM, rmdir, Del, erase, RD, if you want to ask how these aliases are written or how to come, small set hint, these aliases are DOS and Linux system, delete files and delete the directory command. Take a closer look, don't you think?
You can use the "get-help remove-item-full" command to view the complete Help documentation for Remove-item, which reads as follows:
Copy Code code as follows:
PS d:\> get-help Remove-item-full
Name
Remove-item
Summary
Deletes the specified item.
Grammar
Remove-item [-literalpath] [-credential] [-exclud
E] [-filter] [-force] [-include] [-recurse]
[-confirm] [-whatif] [-usetransaction] []
Remove-item [-path] [-credential] [-exclude ng[]>] [-filter] [-force] [-include] [-recurse] [-confi
RM] [-whatif] [-usetransaction] []
Description
The Remove-item cmdlet deletes one or more items. Because many providers support it, it can delete
In addition to a number of different types of items, including files, directories, registry keys, variables, aliases, and functions.
I do not copy the specific parameters, interested friends to see for themselves. Here Hongo to explain is the appearance of-exclude and-include, you see it is necessary to understand it can use the wildcard character bulk operation. -forece should be mandatory delete, delete what, that is of course read-only files or hidden files. -recurse is to iterate through the contents of a subfolder.
Delete a registry key
Like the "Remove-item hklm:\software\mycompany\oldapp-recurse" command, you can delete items under the specified registration path.
About PowerShell use Remove-item to delete files, this article on the introduction so much, I hope to help you, thank you!