Board logo

标题: 只显示文件名,怎么写dos命令 [打印本页]

作者: dhh45     时间: 2010-9-16 12:37    标题: 只显示文件名,怎么写dos命令

dir  “*.txt”  /a /b  /s
获得
       文件夹1/文件夹2/文件夹4/1.txt
          文件夹1/文件夹2/文件夹5/2.txt
          文件夹1/文件夹3/文件夹6/3.txt
          文件夹1/文件夹3/文件夹6/4.txt
想获得
       1.txt
          2.txt
          3.txt
          4.txt

[ Last edited by dhh45 on 2010-9-16 at 12:42 ]
作者: slore     时间: 2010-9-16 13:06
for+%%~NXI
作者: dhh45     时间: 2010-9-16 13:25
不好意思啊,怎么使用啊?
作者: lovelymorning     时间: 2010-9-16 23:44
for /f "delims=" %%a in ('dir  “*.txt”  /a /b  /s') do (echo %%~nxa)