MS-DOS and Windows command line tree command

Updated: 03/13/2021 by Computer Hope
tree command

The tree command allows the user to view an easy-to-read list of files and folders.


Tree is an external command that is available for the following Microsoft operating systems as

Tree syntax

TREE [Drive:[[Path] [/F] [/A]
Drive:\Path Drive and directory containing disk for the display of directory structure.
/F Displays the file names contained in each directory.
/A Extended characters used for linking lines instead of graphic characters. /a is used with code pages that do not support graphics characters and to send output to printers that do not properly interpret graphics characters.

Tree examples

Tree directory structure

The tree command typed alone produces a listing and overview of the current directory (shown in the image to the right).


In the example, C: is the current directory, "banners" is one of the directories, and "big" is a subdirectory of the "cdn" directory.

tree /F

The command above uses the tree command with the /F switch. The resulting output would include the names of files located in each of the directories in the tree. Depending on how many files are located in each directory, the tree listing could be quite long.

  • See our tree structure definition if you need further information on the structure of a tree.

To output the structure of a directory to a file, and other options, try using the dir command.