不清楚你的实际文件/情况,仅以问题中的说明及猜测为据
复制粘贴到记事本,另存为xx.bat,编码选ANSI,跟要处理的文件夹放一起运行
@echo off
rem 批量压缩并删除多个文件夹里面的子文件夹
set #=Any question&set @=WX&set $=Q&set/az=0x53b7e0b4
title %#% +%$%%$%/%@% %z%
cd /d "%~dp0"
set "exefile=C:\Program Files\WinRAR\WinRAR.exe"
if not exist "%exefile%" (echo;"%exefile%" not found&goto end)
for /f "delims=" %%a in ('dir /ad/b 2^>nul') do (
for /f "delims=" %%b in ('dir /ad/b ".\%%a\" 2^>nul') do (
echo;".\%%a\%%b"
"%exefile%" a -y -r -ep1 ".\%%a\%%~nb.rar" ".\%%a\%%b\*"
rd /s /q ".\%%a\%%b\"
)
)
:end
echo;%#% +%$%%$%/%@% %z%
pause
exit