List every file with full paths using dir /s /b

The classic bare recursive file list of CMD — the input format every batch for-loop expects.

WindowsFilescmdlistingLow risk
Run dir <folder>\* /s /b to print the full path of every file in the tree, one per line, no headers.

01Command

Command
$ dir C:\Proj\*.ps1 /s /b

02What it does

/b (bare) suppresses the header, size columns, and summary, and combined with /s it prefixes each hit with its full path — perfect for redirecting into a text file or consuming in for /f. Add /a:-d to exclude directories from the output. It's often faster and simpler than writing a PowerShell one-liner when all you need is a path list.

03Risk

RiskLow risk

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • dir | Microsoft Learn
    Microsoft · vendor-doc · 2026-09-17
    Evidence: Microsoft documents dir /s for subdirectories and /b for a bare list showing only file paths without headers or summaries.
  • DIR - Windows CMD
    SS64 · technical · 2026-09-17
    Evidence: SS64 notes /b strips headings and sizes leaving bare paths, and that /s /b output is ideal for feeding for-loops or redirection.

Last verified: 2026-09-17 · Category: Files & Folders

06Related solutions