@echo off
setlocal enabledelayedexpansion
echo the current batch path is:
echo "%~dp0"
cd/d "%~dp0"
for/f " USEBACKQ delims= "%%i in (' dir/a-d/b/S *.rar ') do (
echo"%%i "
set rar_path=%%~dpi
echo"!rar_path! "
REM changes to the directory where the RAR is located, and then removes the hidden and read-only properties of all RAR files in that directory. Otherwise winrar cannot be processed.
cd/d "!rar_path!"
Attrib-h-R "!rar_path!" */s/d
REM when using the command below, please find the WinRAR help document yourself, so that you can overwrite the existing file directly.
"C:\Program files\winrar\winrar.exe" X-r-inul-y "!rar_path!\*.rar" *-o-
del "!rar_path!\*.rar"
) C15/>rem winrar command-line mode, the hidden file cannot be processed automatically, it will not be decompressed, and for a read-only compressed file, you must use the attrib command to remove the-h-r attribute.
rem above the attrib command, which must be followed by an asterisk *, otherwise the attrib command prompts: "File not Found-C:\Users\lm\CMB\PB40\"