Generate list of files in a folder using DOS There may be instances when you wish to generate a list of files The following DOS command can be useful in achieving the above /B – bare format, no summaries and headings /A:-D – no directories, files only and to save the list we can redirect the result to another file. The following command will generate a list of all the files in the root folder and write to a file C:list1.txt DIR *.* /B /A:-D > C:list1.txt The following command will generate a list of all the files in the root folder and all its subfolders and write to a file C:list2.txt DIR *.* /S /B /A:-D > C:list2.txt Lets look at the demo to understand the above steps.