中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-09-08 21:30
47,812 topics / 349,914 posts / today 0 new / 48,268 members
DOS疑难解答 & 问题讨论 (解答室) » To output filenames without paths using the `dir` command, you can use the `/b` (bare) option. For example, `dir /b` will list only the filenames in the current directory without showing the path information.
Printable Version  4,404 / 1
Floor1 cheng888 Posted 2021-10-01 22:12
新手上路 Posts 1 Credits 4
How to use dir to output the file names of all files in the specified directory and its subdirectories, without directory names and paths. I currently use dir /a:-d /b /s *.*>搜索.xls, but the result always retains the path. I don't need this path. I don't know how to achieve it.
Floor2 beyound Posted 2023-12-17 15:40
新手上路 Posts 1 Credits 2
dir /a:-d /b /s *.* will not exclude directory names and paths unless you remove /s. If you must do recursion, you can handle it with for. for /f "delims=" %%i in ('dir /a:-d /b /s *.*') do echo,%%~nxi
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023