BatchRAR

来源:互联网 发布:竞彩足球对阵数据 编辑:程序博客网 时间:2024/05/24 02:38
 
; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.1.1.0
;
; Script Function:
;BatchRAR 批量压缩文件
;
; ----------------------------------------------------------------------------

; Script Start - Add your code below here

Dim $dir
Dim $cmd

Dim $attrib
Dim $search

; Change to user specified dir
$dir = @ScriptDir
FileChangeDir($dir)

; Shows the filenames of all files in the current directory, note that "." and ".." are returned.
$search = FileFindFirstFile("*")

; Check if the search was successful
If $search = -1 Then
Exit
EndIf

While 1
$file = FileFindNextFile($search)
If @error Then
ExitLoop
EndIf

If $file <> "." Then
If $file <> ".." Then
$attrib = ""
$attrib = FileGetAttrib($file)
If StringInStr($attrib, "D") Then
$cmd = "C:/Program Files/WinRAR/Rar.exe a -m0 -ep "
$cmd = $cmd & $dir & "/" & $file & ".RAR "
$cmd = $cmd & $dir & "/" & $file & "/" & "*.*"
RunWait($cmd, "", @SW_HIDE)
EndIf
EndIf
EndIf
WEnd

; Close the search handle
FileClose($search)

MsgBox(0, "压缩成功", " (*^__^*)")
原创粉丝点击