Examples of matching file paths using wildcard characters in PowerShell _powershell

Source: Internet
Author: User

Asterisk (*) in the era of DOS, is the wildcard character (English called wildcard) representative. From DOS to Windows to PowerShell, the asterisk sticks to the wildcard post as usual.

Simply look at an example:

Copy Code code as follows:

PS [Zhanghong] >dir D:\*.vbs
Table of Contents: D:\
Mode LastWriteTime Length Name
----                -------------     ------ ----
-A---2013/6/5 16:42 211 test.vbs

The role of this example is to list all the files for the VBS suffix in the D-packing directory.

Small series often use PowerShell to deal with the path, how flexible from the directory system to take out their own files are small series has been the pursuit. Inadvertently, small braided now PowerShell path, you can use more than one wildcard character, thus greatly improve efficiency.

When we open a virtual host, we put all the user data in a directory of such a pattern:

Copy Code code as follows:

D:\wwwroot\ website Name \wwwroot\

If I want to find the index.php file at the root of all users ' sites, we can take a wildcard character in the path:
Copy Code code as follows:

Dir d:\wwwroot\*\wwwroot\index.php

Further, if we want to see all the files with index as the filename, that's OK:
Copy Code code as follows:

Dir d:\wwwroot\*\wwwroot\index.*

Hackers often like to name index or default file inside the black chain, we can use this way to quickly find the relevant documents, good for the next reconnaissance work.

OK, about the use of wildcards in the path, say so much, 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.