Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- Title 7z Compressing multi-subfolders
- :: set the current directory to the batch file location
- cd /d %~dp0
- Call :Check_7Zip
- @for /d /r %%D in (*) do (
- PUSHD %%D
- @for %%A in (*.*) do (
- echo "%Zip%" a "%%D.7z" "%%A"
- "%Zip%" a "%%D.7z" "%%A"
- If Exist "%%A" Del "%%A"
- )
- POPD
- )
- pause
- Exit
- ::-----------------------------------------------------------------------------------------------------------------------------
- :Check_7Zip
- Reg Query "HKEY_CURRENT_USER\SOFTWARE\7-Zip" /v "Path">nul 2>&1
- If [%errorlevel%] EQU [1] ( echo 7-Zip Not found !
- ) else (
- @FOR /f "tokens=2*" %%i in ('Reg Query "HKEY_CURRENT_USER\SOFTWARE\7-Zip" /v "Path" 2^>nul') do (Set "Zip=%%j7z.exe")
- )
- Exit /B
- ::-----------------------------------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment