With cmd or .bat scripts, is there a way to list only file names and folder names? I would like to run a batch file to produce a text file that contains this information.
Suppose I have the following folder:
C:\test\test.bat
C:\test\Doc1.exe
C:\test\Doc2.docx
C:\test\subdir1\Doc3.pdf
C:\test\subdir2\Doc4.txt
I'd love to have an output like this:
Doc1.exe
Doc2.docx
test.bat
subdir1
subdir2
So far, this answer is the closest I could get. With an output of:
Doc1 exe
DOC3~1 DOC
subdir1
subdir2
test bat
I've tried dir:
dir /b /a-d >filelist.txt
But it didn't get what I wanted. (i.e., it only list file names but not folder names).
Thank you!