- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to search for files using the wildcard character (*) in PowerShell?
You can also search for files with a specific name or using the wildcard (*) character.
Command
Below command will search for the files (including hidden files) starting with “Bac”.
Get-ChildItem D:\Temp -Recurse -Force -Include Bac*
Output
PS C:\WINDOWS\system32> Get-ChildItem D:\Temp -Recurse -Force -Include Bac* Directory: D:\Temp\GPO_backup\{C9C3DB4C-2E51-4201-B3C3-7C0F1ACECBE9} Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 24-11-2018 11:34 6215 Backup.xml
Command
When you use the wildcard character (*) at both the ends, file name containing that string will be displayed. For example, the below command will display all the files which contain the word “tmp”.
Get-ChildItem D:\Temp\ -Recurse -Force -Include *tmp*
Output
PS C:\WINDOWS\system32> Get-ChildItem D:\Temp\ -Recurse -Force -Include *tmp* Directory: D:\Temp\GPO_backup\{C9C3DB4C-2E51-4201-B3C3-7C0F1ACECBE9}\DomainSysvol\GPO\Machine\microsoft\windows nt\SecEdit Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 24-11-2018 11:34 16028 GptTmpl.inf
Advertisements