-
-
Save Lord-Memester/e91d34dc3d6880a9e541fdba188732bb to your computer and use it in GitHub Desktop.
7zip: Unzip and delete context menu. Registry entry and .bat file for windows context menu "unzip and delete" command. instead of needing to unzip, then delete an archive manually
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
set output_dir=%~n1 | |
IF EXIST "%output_dir%\" ( | |
echo "%output_dir%\" already exists, gonna increment the name | |
set "n=0" | |
:loop | |
set /a n+=1 | |
set "output_dir=%output_dir%_%n%" | |
if exist "%output_dir%" echo "%output_dir%" already exists & goto :loop | |
) | |
"%ProgramFiles%\7-Zip\7z.exe" x %1 -o"%output_dir%\" | |
IF %ERRORLEVEL% EQU 0 IF EXIST "%output_dir%\" ( | |
echo "%output_dir%\" was created | |
del %1 | |
) else ( | |
Echo An error was found & pause | |
) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Windows Registry Editor Version 5.00 | |
[HKEY_CLASSES_ROOT\*\shell\Unzip and delete] | |
"icon"="C:\\Program Files\\7-Zip\\7zG.exe" | |
[HKEY_CLASSES_ROOT\*\shell\Unzip and delete\command] | |
@="\"<PATH TO>\\unzip_and_delete.bat\" \"%1\"" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment