回复 5# 7803181 - @echo off & cd /d "%~dp0"
- setlocal enabledelayedexpansion
- set "rarPath=C:\Program Files\WinRAR"
- set "path=%path%;%rarPath%"
- set "dirList="
- for /r /d %%i in (*) do (
- pushd "%%i"
- for /l %%a in (1,1,2) do cd ..
- if "!cd!\"=="%~dp0" (
- echo pack %%i
- pushd "%%i"
- set "dirList="
- for /d %%i in (*) do call set "dirList=!dirList! "%%i""
- for %%i in ("!cd!") do rar a "%%~nxi.rar" !dirList!
- popd
- echo ------------------
- )
- popd
- )
- pause&exit
复制代码
|