Tree command

Updated: 11/12/2023 by Computer Hope
tree command

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

Availability

Tree is an external command available for the following Microsoft operating systems as tree.com.

Tree syntax

Windows 10 and 11 syntax

TREE [Drive:][Path] [/F] [/A]
Drive:\Path Drive and directory containing disk for the display of directory structure.
/F Display the names of the files in each folder.
/A Use ASCII (American Standard Code for Information Interchange) instead of extended characters.

Windows 8 and earlier 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 are 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).

tree

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

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