给7Zip压缩自动增加时间戳

WinRAR压缩文件有一个很方便的选项是在文件名追加压缩时间,但是RAR是收费软件,价格不菲.使用7-Zip就没有这样的功能了么?

其实只要自己动手也能丰衣足食,给7-Zip加上这个功能:

首先在运行中输入

  1. shell:sendto

打开自己的发送到文件夹.

在文件夹新建一个文本文档,并贴入以下代码保存为ANSI编码

  1. [set](http://search.microsoft.com/default.asp?so=RECCNT&siteid=us%2Fdev&p=1&nq=NEW&qu=set&IntlSearch=&boolean=PHRASE&ig=01&i=09&i=99) hh=%[time](http://search.microsoft.com/default.asp?so=RECCNT&siteid=us%2Fdev&p=1&nq=NEW&qu=time&IntlSearch=&boolean=PHRASE&ig=01&i=09&i=99):~0,2%
  2. [if](http://search.microsoft.com/default.asp?so=RECCNT&siteid=us%2Fdev&p=1&nq=NEW&qu=if&IntlSearch=&boolean=PHRASE&ig=01&i=09&i=99) %hh% LSS 10 ([set](http://search.microsoft.com/default.asp?so=RECCNT&siteid=us%2Fdev&p=1&nq=NEW&qu=set&IntlSearch=&boolean=PHRASE&ig=01&i=09&i=99) hh=0%[time](http://search.microsoft.com/default.asp?so=RECCNT&siteid=us%2Fdev&p=1&nq=NEW&qu=time&IntlSearch=&boolean=PHRASE&ig=01&i=09&i=99):~1,1%)
  3. [set](http://search.microsoft.com/default.asp?so=RECCNT&siteid=us%2Fdev&p=1&nq=NEW&qu=set&IntlSearch=&boolean=PHRASE&ig=01&i=09&i=99) dst=%[date](http://search.microsoft.com/default.asp?so=RECCNT&siteid=us%2Fdev&p=1&nq=NEW&qu=date&IntlSearch=&boolean=PHRASE&ig=01&i=09&i=99):~0,4%%[date](http://search.microsoft.com/default.asp?so=RECCNT&siteid=us%2Fdev&p=1&nq=NEW&qu=date&IntlSearch=&boolean=PHRASE&ig=01&i=09&i=99):~5,2%%[date](http://search.microsoft.com/default.asp?so=RECCNT&siteid=us%2Fdev&p=1&nq=NEW&qu=date&IntlSearch=&boolean=PHRASE&ig=01&i=09&i=99):~8,2%_%hh%%[time](http://search.microsoft.com/default.asp?so=RECCNT&siteid=us%2Fdev&p=1&nq=NEW&qu=time&IntlSearch=&boolean=PHRASE&ig=01&i=09&i=99):~3,2%%[time](http://search.microsoft.com/default.asp?so=RECCNT&siteid=us%2Fdev&p=1&nq=NEW&qu=time&IntlSearch=&boolean=PHRASE&ig=01&i=09&i=99):~6,2%
  4. "C:\Program Files\7-Zip\7z.exe" a %1_%dst%.zip %1

修改文件名为

7zBackup.bat

使用时选中需要压缩的文件或者目录,选择发送到7zBackup.bat即可。

以上在Window 7 64bit,7-Zip 9.2 64bit下验证通过。