7zip self-extracted executable: To extract file to specific directory

1) Install 7-zip (7zS.sfx will be installed to C:\Program Files\7-Zip):

http://7zsfx.solta.ru/en/


2) Copy following script snippet into notepad and save as config.txt with UTF-8 encouding by selecting File -> Save As... -> Switch Encoding to "UTF-8"

;!@Install@!UTF-8!
CancelPrompt="Are you sure you want to cancel?"
FinishMessage="Hi, file has been successfully extracted! "
GUIFlags="8+128"
InstallPath="%Programfiles%\\MyFolder\\Contain Space"
ExtractPathText="Please select extraction path:"
ExtractPathTitle="Welcome to use 7zip self-extracting archive"
ExtractCancelText="Abort"
;!@InstallEnd@!

 

3) Make a folder for placing the file(s) you expect to extract.

4) Select all and right-click on any one of them, select "Add to archive...", Change archive name, set compression level to Ultra, click OK

5) Copy 7zs.sfx and config.txt to the same folder

6) Open a command line, CD to this folder (Or, press SHIFT [do not let go] and right-click in the blanks inside this folder, select Open command window here)
enter following command line
copy /b 7zs.sfx + config.txt + ArchiveName.7z Self-Extract-Executable-Name.exe

 

Reference:

http://sevenzip.sourceforge.jp/chm/cmdline/switches/sfx.htm

http://www.msfn.org/board/topic/99843-7-zip-sfx-extract-to-this-folder/

http://sourceforge.net/p/sevenzip/discussion/45797/thread/31dc880f

 

转载于:https://www.cnblogs.com/cindy-hu-23/p/4300069.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值