Output of tree in command prompt

后端 未结 5 1858
耶瑟儿~
耶瑟儿~ 2021-01-30 17:22

I was hoping to be able to use the

tree /F /A > \"desktop\"\\file.txt

command to output only text files. Currently as is, it outputs every

5条回答
  •  我在风中等你
    2021-01-30 18:08

    Tree accepts only a few command line parameters:

    c:\>Tree /?
    Graphically displays the folder structure of a drive or path.
    
    TREE [drive:][path] [/F] [/A]
    
       /F   Display the names of the files in each folder.
       /A   Use ASCII instead of extended characters.
    

    None of the indicated parameters are a file mask or filter.

    You can use dir with the proper switches, and redirect the output to a text file. You'll get the full path name to the files, but you can filter that out in later processing if need be with a for loop:

    C:\>dir *.txt /s /b > filelist.txt
    

提交回复
热议问题