Resource icon

7Zip batch files per extension 2021-11-29

Requirements: install 7Zip into a default location.

default locations:
  • ProgramFiles(x86)\7-zip\7z.exe
  • ProgramFiles\7-zip\7z.exe

Drag and drop a file onto the .BAT, and the batch script will automate 7Zip's file compression. This only includes files with the same file extension, in the same folder.
Change log
@echo off
rem 7z.exe path
set sevenzip=
if [%1]==[] echo file not found&pause&exit
if "%sevenzip%"=="" if exist "%ProgramFiles(x86)%\7-zip\7z.exe" set sevenzip=%ProgramFiles(x86)%\7-zip\7z.exe
if "%sevenzip%"=="" if exist "%ProgramFiles%\7-zip\7z.exe" set sevenzip=%ProgramFiles%\7-zip\7z.exe
if "%sevenzip%"=="" echo 7-zip not found&pause&exit
cd /d %~dp1||(echo ERROR&pause&exit)
echo %~dp1
echo %~x1
pause
for %%a in (*%~x1) do "%sevenzip%" a "%%~na.7z" "%%a"
pause
Author
zfreeman
Downloads
64
Views
457
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from zfreeman

General chit-chat
Help Users
  • No one is chatting at the moment.
    Psionic Roshambo @ Psionic Roshambo: https://youtu.be/g3U7tCipvdQ