PowerShell Use the remove-item command to delete files, registry entries _powershell

Source: Internet
Author: User
Tags aliases

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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.