首页 > 解决方案 > Win10 CMD 只导出目录和子目录中的文件名

问题描述

我想用 Win10 CMD 解压到一个txt文件,只有目录和子目录中的文件名。

我最接近的是

V:\Scanned Pictures>dir *.jpg /s/d/a:-d "folderpath" > test1.txt

它只列出文件名,但还包括目录的“标题”,如:

================================================================= Not wanted
 Volume in drive V is Pictures
 Volume Serial Number is C1FA-29F2

 Directory of V:\Scanned Pictures\1988-06 California trip
================================================================= Not Wanted
1988-06 California trip Kathleen Beach 1.jpg   <<<-- Just the file name

标签: cmddirectorywindows-10

解决方案


只需添加 /b 选项

dir *.jpg /b/s/d/a:-d "folderpath" > test1.txt

根据目录/?信息,/b 使 dir 显示无标题或摘要的裸格式


推荐阅读