13

I'd like to be able to right-click on a file in Windows Explorer, then the 7-Zip sub-menu, and then instead of something like, 'Add to archive...', I'd like, 'Add to <filename>-<today's date>.7z'

A picture is worth a thousand words:

Explorer Content Menu

This would be a customisation not currently offered by 7-Zip (as far as I'm aware).

1 Answer 1

10

7-zip is open source so I suppose you could implement this feature yourself (tee hee) or petition/pay the core developers to do it for you. In lieu of that:

You can't do it by configuring 7-zip options, but you can do it by making a new context menu item. The text won't be dynamic like your mockup, but the results will be the same.

Basically what you're going to need to do is create a batch script that launches 7-zip with the right parameters to take the file you specify and add it to an archive, supplying today's date as the file name.

This script will do that (based on the script from here). Paste this into a new text file called 7ztoday.bat:

@echo off
FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET CDATE=%%B
FOR /F "TOKENS=1,2 eol=/ DELIMS=/ " %%A IN ('DATE/T') DO SET mm=%%B
FOR /F "TOKENS=1,2 DELIMS=/ eol=/" %%A IN ('echo %CDATE%') DO SET dd=%%B
FOR /F "TOKENS=2,3 DELIMS=/ " %%A IN ('echo %CDATE%') DO SET yyyy=%%B

"%programfiles%\7-zip\7z.exe" a %mm%%dd%%yyyy%.7z %1

Then, using a utility such as Default Programs Editor, we can add a new context menu item for files that points at this batch script. For convenience, I exported this change as a reg file, so you can just copy this into a new text file ending with .reg and double click to merge into the registry.

Windows Registry Editor Version 5.00

; Created with Default Programs Editor 
; http://defaultprogramseditor.com/

; Add Verb
[HKEY_CURRENT_USER\Software\Classes\*\shell\AddToTodaysArchive_verb_key]
@="Add file to today's archive"
[HKEY_CURRENT_USER\Software\Classes\*\shell\AddToTodaysArchive_verb_key\command]
@="\"C:\\Users\\Public\\7ztoday.bat\" \"%1\""

Regarding 7-zip settings:

That particular sub menu is registered by 7-zip, and you can configure what appears on the submenu from that program's options, by opening the 7-Zip File Manager and going to Tools -> Options -> Plugins, select "7-Zip", then click Options. On the list in that window is all the built in options that are available for that secondary list in the context menu.

enter image description here

2
  • I've used this before. However, I would like to add a custom menu item which auto generates an archive filename and appends today's date on the end. Nov 4, 2009 at 9:50
  • Updated answer with a work around that adds a new top level context menu item. Nov 4, 2009 at 19:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .