Print a Directory Tree on Windows

Show folders and files as an indented tree from the command line.

WindowsFilesdirectoryTerminalLow risk
Run tree /f to print a recursive listing of the current directory.

01Command

Command
$ tree /f

02What it does

The Windows tree command draws the folder hierarchy with connector characters. The /f switch includes file names, /a uses plain ASCII lines for compatibility, and you can pass a drive or path to start elsewhere. It is a quick way to document a project layout.

03Risk

RiskLow risk
RequirementsWindows 10/11 with PowerShell 5.1 or PowerShell 7+
!Warning: Very deep or large trees produce huge output; redirect to a file and inspect rather than printing everything.

04Undo

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

05Sources

  • tree
    Microsoft Learn · vendor-doc · 2026-09-20
    Evidence: Windows command that graphically displays the folder structure; /f includes files.

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

06Related solutions