ygqiang 当前离线
少尉
评分人数
qixiaobin0715 发表于 2024-9-30 08:59
TOP
qixiaobin0715 当前离线
大校
@echo off for /f "delims=" %%i in ('dir /b /ad^|findstr /r /c:"[^- '!-Z]"') do ( echo,rd /s /q /f "%%i" ) for /f "delims=" %%i in ('dir /b /a-d^|findstr /r /c:"[^- '!-Z]"') do ( echo,del /f /q "%%i" ) pause复制代码
回复 ygqiang 以下代码存为 test.bat 放在根目录下运行 当前代码用于实际删除前预览删除结果是否正确 ... aloha20200628 发表于 2024-9-29 18:07
aloha20200628 当前离线
少校
@echo off &setlocal for /f "delims=" %%F in ('dir /b/a-d') do set "nF=%%~nF"&call :testHZ 1 "%%F" for /f "delims=" %%D in ('dir /b/ad') do set "nF=%%~nD"&call :testHZ 2 "%%D" endlocal&pause&exit/b :testHZ if "%nF%"=="" (exit/b) set "c=%nF:~,1%" if "%c%" gtr "Z" ( REM if %1 equ 1 (del /q "%~2") else (rd /s/q "%~2") if %1 equ 1 (echo,del /q "%~2") else (echo,rd /s/q "%~2") exit/b ) set "nF=%nF:~1%" &goto :testHZ exit/b复制代码