首先你需要安裝 WinRAR,然後在任何你想放指令的位置(例如 C:\bin
),將環境變數指向到這邊來。
接著下載這兩個 bat 檔,放在你環境變數指向的位置即可。
打開 cmd 或 PowerShell,輸入以下指令
$ zip <Zip file> <Target Folder>
例如
$ zip C:\www\myfile.zip C:\www\myfolder
輸入以下指令
$ unzip <Zip file> <Target Folder>
例如
$ unzip C:\www\myfile.zip C:\www\myfolder
WinRAR Manual http://acritum.com/software/manuals/winrar/
Using the WinRAR Command-line tools in Windows http://comptb.cects.com/using-the-winrar-command-line-tools-in-windows/
use winrar command line to create zip archives http://stackoverflow.com/questions/3828765/use-winrar-command-line-to-create-zip-archives