批量文件操作-批处理删除文件夹

@echo off
if {%1} EQU {} goto NoParameter
echo 确认删除?

ver| find "5.1." >NUL  && goto win_under_2003
ver| find "5.0." >NUL  && goto win_under_2003
ver| find "4.90." >NUL  && goto win_under_2003
ver| find "4.10." >NUL  && goto win_under_2003
ver| find "4.0." >NUL  && goto win_under_2003
ver| find "3.51." >NUL  && goto win_under_2003
choice /c:yn
if errorlevel 2 echo 已取消。&&pause 1>nul&&exit /b
goto start
:win_under_2003
set /p choice=[y/n]?
if {%choice%} NEQ {y} if {%choice%} NEQ {Y} echo 已取消。&&pause 1>nul&&exit /b

:start
@echo on
rd /q /s %1.\
@shift
@if {%1} NEQ {} goto start
@echo=
@echo 已完成。
@pause 1>nul
@exit /b

:NoParameter
echo=
echo 本程序可批量删除文件夹: 选择一个或多个文件夹,拖动到本批处理文件上即可。
pause 1>nul
exit /b

你可能感兴趣的:(其他编程)