China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-02 02:24
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Here comes another path problem. View 1,610 Replies 8
Original Poster Posted 2006-09-20 01:28 ·  中国 云南 昆明 电信
初级用户
★★
Credits 134
Posts 50
Joined 2006-03-28 13:50
20-year member
UID 52939
Status Offline
How to make the command delete files only in the current path of the drive letter without entering other directories and subdirectories?
Floor 2 Posted 2006-09-20 01:33 ·  中国 湖北 武汉 教育网
新手上路
Credits 9
Posts 5
Joined 2006-05-10 11:27
20-year member
UID 55257
Status Offline
for %%i in (c d) do del /q %%i:\1.log
Floor 3 Posted 2006-09-20 03:59 ·  中国 甘肃 兰州 电信
金牌会员
★★★★
Credits 4,103
Posts 1,744
Joined 2006-01-20 13:00
20-year member
UID 49241
Gender Male
From 甘肃.临泽
Status Offline
for %%i in (%cd%) do del /s/q %%i:\1.log
Floor 4 Posted 2006-09-20 06:29 ·  中国 云南 昆明 电信
初级用户
★★
Credits 134
Posts 50
Joined 2006-03-28 13:50
20-year member
UID 52939
Status Offline
Thanks to the first two friends.
I just want to delete the problem in the root directory, not to search other directories and subdirectories.
How to set %cd%?

[ Last edited by xg911335 on 2006-9-20 at 06:51 ]
Floor 5 Posted 2006-09-20 07:19 ·  中国 甘肃 兰州 电信
金牌会员
★★★★
Credits 4,103
Posts 1,744
Joined 2006-01-20 13:00
20-year member
UID 49241
Gender Male
From 甘肃.临泽
Status Offline
Floor 6 Posted 2006-09-20 07:39 ·  中国 北京 鹏博士BGP
中级用户
★★
Credits 404
Posts 179
Joined 2006-03-30 14:44
20-year member
UID 53056
Status Offline
You should go and check the help of these commands. It will be mentioned above.
Floor 7 Posted 2006-09-20 08:19 ·  中国 湖南 娄底 新化县 电信
银牌会员
★★★
Credits 1,218
Posts 485
Joined 2006-07-21 21:24
20-year member
UID 58987
From 湖南.娄底
Status Offline
The friend on the second floor has already provided the code. The code of the original poster added the /s parameter, so it will delete the matching files in the subdirectories.
业精于勤而荒于嬉,形成于思而毁于随。
Floor 8 Posted 2006-09-21 09:20 ·  中国 云南 昆明 电信
初级用户
★★
Credits 134
Posts 50
Joined 2006-03-28 13:50
20-year member
UID 52939
Status Offline
Floor 9 Posted 2006-09-21 09:25 ·  中国 广东 佛山 广东睿江科技有限公司
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
Adding the parameter `/a` to `del` to delete all attribute folders is relatively perfect.
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Forum Jump: