•Arnošt Havelka
Wildcards
Magic characters for file matching.
Start Interactive LessonWildcards are special characters that act as placeholders for other characters. They are incredibly powerful when you want to perform operations on groups of files rather than one at a time. The two most common are * and ?.
Try the command
Try using a wildcard pattern!
Build the command
dir
*Matches zero or more characters. e.g. *.txt matches all text files.
?Matches exactly one character. e.g. file?.txt matches file1.txt but not file10.txt.
Terminal
C:\Users\Student>dir Reports\*.txt
Directory of C:\Users\Student
04/11/2026 08:20 AM <DIR> .
04/11/2026 08:20 AM <DIR> ..
04/11/2026 08:20 AM 7 summary.txt
1 File(s)
0 Dir(s)
Real-World Examples
List all text files:
Terminal
C:\Users\Student>dir *.txt
Match files with a specific pattern:
Terminal
C:\Users\Student>dir img_??.jpg
Knowledge Check
1 / 2Which wildcard matches any number of characters?
References
These documentation links provide authoritative details for the commands used in this article.
Up Next
The MKDIR Command
Learn how to create directories from the command line.