SourceForge has been redesigned. Learn more.

7-zip compression batch script for shell:sendto

  • Alex

    Alex - 2013-10-11

    hi guys i need a batch script for context menu(C:\Users\Admin\AppData\Roaming\Microsoft\Windows\SendTo) for compress file/files/folder/nested folder...

    how can i do that?

    thanks :D

  • fernando

    fernando - 2013-10-12

    show code what you try

  • Alex

    Alex - 2013-10-12

    SET zpath="D:\Dropbox\7zip\7za.exe"
    FOR %%A IN (%*) DO (
    %zpath% a -t7z -r -mx7 %%A.7z %%A

    sometime for example i have textsample.txt when i use the script i have textsample.txt.7z
    - how can i remove .txt(

    • how can i place the .7z file in the same directory of the file or directory zipped and NOT in the 7z.exe path ?
  • fernando

    fernando - 2013-10-12

    see FOR variable substitution and modifiers reference...

      %zpath% a "%%~dpnA" -mx7 -r %%A
  • Alex

    Alex - 2013-10-15


    i need some help here xD

    with this script i make a backup or incremental backup if the archive already exist, but for some reason not work

    @echo off
    setLocal EnableDelayedExpansion

    set destination=d:\Backup Privato
    set zipdir="D:\wpp_menu_net\winPenPack\Bin\7-Zip\7z.exe"

    set year=%date:~-4,4%
    set day=%date:~-10,2%
    set month=%date:~-7,2%
    set hour=%time:~-11,2%
    set hour=%hour: =0%
    set min=%time:~-8,2%
    set seconds=%time:~-5,2%
    set milliseconds=%time:~-2,2%
    set zipfilenameDIFF="diff_backup_%day%.%month%.%year%.%hour%%min%%seconds%_"

    for /f "tokens=* delims= usebackq" %%a in ("Mybackupfile.txt") do (

    REM directory %%a
    REM nome %%~na
    REM echo %destination%\%%~na.7z
    if exist %destination%\%%~na.7z (
        %zipdir% u "%destination%\full_backup_%%~na.7z" "%%a" -ms=off -mx=9 -t7z -u- -up0q3r2x2y2z0w2!%destination%\%zipfilenameDIFF%%~na.7z
    %zipdir% a -mx=9 -t7z "%destination%\%%~na.7z" "%%a"




Log in to post a comment.