Introduction to PowerShell System Management

Source: Internet
Author: User

Introduction

PowerShell was officially released by Microsoft in the fourth quarter of 2006, and its emergence marks a significant step in Microsoft's move to the server sector, bridging the gap between Uxin and Linux systems

PowerShell defines more than 200 cmdlet

First, the use of the cmdlet management system

(1), Management files, folders

For PowerShell, files and folders are referred to as items (item), and files and folders are distinguished by parameters

1, New-item: Create a file or folder

"New-item commonly used parameters"

-force: Allow cmdlet to create items to overwrite existing read-only entries

-itemtype: Specifies the type of new item, such as file, folder is directory

-name: Specifies the name of the new item to be created

-path: Specifies the path to the new item

-value: Specifies the value of the new item

"For example, create a new folder under C disk, named PowerShell"

New-item-path c:\-name Powershell-itemtype Directory

"For example, create a text file under the PowerShell folder, named Date.txt, content Hello"

New-item-path c:\Powershell-Nmae date.txt-value "Hello"-itemtype file

2, Get-childitem: Display folder Contents

"Get-childitem commonly used parameters"

-force: Get hidden files or system files

-include: Retrieves only the specified item, the value of this parameter qualifies the path parameter

-name: Retrieve only the names of the items in the location

-path: Specifies the path of one or more locations, the default location is the current directory ()

-recurse: Gets the items in the specified location and all its subkeys

"Example, retrieving all txt files in the current directory and its subdirectories"

Get-childitem. -include *.txt-recurse-force

"Example, retrieve the name of the file and folder for the current directory."

Get-childitem-name

3, Remove-item: Delete the specified item

"Remove-item commonly used parameters"

-exclude: Ignore specified item

-force: Delete hidden or system files

-include: Delete only specified items

-path: Specifies the path of the item to be deleted

-recurse: Deletes items in all subkeys of the specified location and these locations

"Example, delete all". "In the C:\PowerShell directory. The file "

Remove-itemc:\powershell\*.*

"Example, remove the syntax for all files with the. doc extension under the current directory."

remove-item*-include *.doc

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.