没人回答,我就公布答案了。- @echo off&setlocal enabledelayedexpansion
- :loop
- set n=1
- if "%~1" neq "" (
- set "name=%~1"
- if !name:~-1! equ . (
- set folder=%~1.\
- rd /s /q !folder! 2>nul && set n=0
- set folder=%~1\
- rd /s /q !folder! 2>nul && set n=0
- if !n!==0 (
- echo %~1删除成功!
- ) else (
- echo %~1删除失败!
- )
-
- ) else (
- echo %~1文件或文件夹不合法!
- )
- ) else (
- goto bye
- )
- shift
- goto loop
- :bye
- echo 全部操作已完成,谢谢使用!!
- pause>nul
复制代码
|