Merry Christmas & Happy 2027! Less downtime. More good times. Celebrating 13 years of sorlavit.com
Skip to content
Sorlavit KimIT Support, Network & Infrastructure Services Let’s talk

Articles are written in English. The Thai translation button opens Google Translate; code and commands stay in their original form.

Windows Commands / IT Support Guides

Find files from Command Prompt with dir

Use dir in Command Prompt to find PDF files under your Documents folder.

Compiled for Sorlavit Kim · Published · Updated · 1 min read

Environment and inputs: Windows 11 · Command Prompt unless PowerShell is specified

Understand the problem

Open Command Prompt. The example uses %USERPROFILE% to find the current account’s profile folder.

Run the command

Run the displayed command. The *.pdf pattern selects names ending in .pdf, /s includes subfolders, and /b prints a plain list of paths.

dir "%USERPROFILE%\Documents\*.pdf" /s /b

Read the output

Each line shows a matching path. If two results have the same filename, compare their folders and check their modification dates before opening one.

Choose the next step

If you get File Not Found, check the starting folder and extension. If Documents was moved to OneDrive or another location, use its actual path.

Before making changes

If the list is large, search a smaller folder or include part of the filename in the pattern.

Source & further reading

Microsoft Learn — dir

Independently written summary reviewed on 2026-11-01. The example illustrates a possible application; it is not a client case study.

Share this article

Back to all articles