中国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-23 12:55
47,812 topics / 349,917 posts / today 0 new / 48,273 members
DOS批处理 & 脚本技术(批处理室) » Batch delete multiple folders
Printable Version  3,177 / 4
Floor1 goltaxhs Posted 2017-09-21 12:45
新手上路 Posts 8 Credits 8
@echo off
title Batch Delete Multiple Folders
rem Only display directories dir /a /d /b
set rdpath=
echo,
echo,+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
echo,Input format for deleting a single folder: c:\home
echo,Input format for deleting multiple folders: d:\*.*,d:\1,d:\2 Separate folders with commas
echo,If there are spaces in the folder, use English double quotes "" to enclose, e.g., "c:\my home", otherwise an error will occur
echo,+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
echo,
set /p rdpath=Please enter the folder(s) to delete:
echo,
for /d %%i in (%rdpath%) do (
if exist %%i (rd /s /q %%i &echo -Deleted folder %%i) else (echo *Folder %%i does not exist)
)

echo,
title
pause
Floor2 zzz19760225 Posted 2017-09-21 13:22
超级版主 Posts 2,020 Credits 3,673
Floor3 zzz19760225 Posted 2017-09-21 13:26
超级版主 Posts 2,020 Credits 3,673
Is there any introductory popular science textbook on Chinese character sets?
Floor4 zzz19760225 Posted 2017-09-21 13:38
超级版主 Posts 2,020 Credits 3,673
Can batch processing display the smallest resolution dot on the screen?
Floor5 zzz19760225 Posted 2017-09-21 13:56
超级版主 Posts 2,020 Credits 3,673
I saved the batch processing as a text, modified the folder hidden option, and changed it to the bat suffix.
I created a folder 1 under C:\.
When running the bat, entering c:\1 can delete it.
But when I added a >1.txt later, it didn't succeed, and I wanted to output the execution content to a text.
Adding | also didn't work.

[ Last edited by zzz19760225 on 2017-9-21 at 14:03 ]
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023