Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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).

share|improve this question

1 Answer 1

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

share|improve this answer
    
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. –  Umber Ferrule Nov 4 '09 at 9:50
    
Updated answer with a work around that adds a new top level context menu item. –  Factor Mystic Nov 4 '09 at 19:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.