VBScript调用RAR压缩文件...
VBScript调用RAR压缩文件
'------------------------------------------------------------
'Backup Data File and Rar File
'
'Create Date: 2009-11-05
'Author: Wei_Zhu
'Chage Log:
'Last Chage Date: 2009-11-05
'-------------------------------------------------------------
BackUpFile("D:/Data")
Function BackUpFile(lstg_folder_name)
Dim fso, f, f1,fc,s,folder
Set fso=CreateObject("Scripting.FileSystemObject")
folder=fso.getfolder(ws.currentdirectory)
Set f=fso.GetFolder(lstg_folder_name)
Set fc=f.files
For Each f1 in fc
dim lf
lf=lstg_folder_name& "/" & f1.name
RarFile lf
Next
End Function
'----Rar File-----
Function RarBackupFile(lastg_file_name)
'/*Rar Program in RarComponent Folder, Program Name is Rar.exe
' Rar Source: Folder + File
' Rar Target: Folder + Target Name .rar */
Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
Set fso=CreateObject("Scripting.FileSystemObject")
folder=fso.getfolder(WshShell.currentdirectory)
RarComponent =folder&"/RarComponent/rar.exe"
SourceFile = lastg_file_name
TargetFile = "D:/data/test.rar"
WshShell.Run RarComponent&" a -ep1 "&TargetFile&" "&SourceFile,0
End Function