rictirse 發表於 2012-12-2 15:01

autoit 背景化調用RAR 壓縮、加密、解壓縮 SRC

autoit 調用 rar 解壓縮、與壓縮
範例載點:http://www.fileswap.com/dl/aExD4c8E3/

Dim $Path = @ScriptDir
Dim $rarPath = $Path&"\rar.exe"
Dim $unrarPath = $Path&"\unrar.exe"
Dim $rarLevel = 0;;; 壓縮等級 0~5; 0 low 、 5high
Dim $rarName = "Mydata";; RAR檔名
Dim $CompressionPath = "";;;壓縮路徑
Dim $DecompressPath = @ScriptDir&"\123";;解壓縮路徑
Dim $psw = "123test"

;;----------------------( Compression )----------------------

FileDelete ($Path&$rarName&".rar");; 刪除舊的rar檔案

$rarComments = StringFormat ( "%s a -m%d -r -hp[%s] %s\%s %s", $rarPath, $rarLevel, $psw,$Path, $rarName, $CompressionPath)

;~ RunWait (@ComSpec & " /k " & $rarComments, "", @SW_SHOW) ;; SHOW
RunWait (@ComSpec & " /c " & $rarComments, "", @SW_HIDE) ;; HIDE

MsgBox ( 0, "" ,"Compression Done!")

;;----------------------( Decompress )----------------------

$unrarComments = StringFormat ( "%s x -y -p[%s] %s\%s %s",$unrarPath, $psw, $Path, $rarName, $DecompressPath)
If Not FileExists ($DecompressPath) Then DirCreate ($DecompressPath);;; 如果解壓縮路徑不存在先建立
;~ RunWait (@ComSpec & " /k " & $unrarComments, "", @SW_SHOW) ;; SHOW
RunWait (@ComSpec & " /c " & $unrarComments, "", @SW_HIDE) ;; HIDE

MsgBox ( 0, "" ,"Decompress Done!")

頁: [1]
查看完整版本: autoit 背景化調用RAR 壓縮、加密、解壓縮 SRC