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.
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.