站长资讯网
最全最丰富的资讯网站

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&”RarComponentrar.exe”

    SourceFile = lastg_file_name

    TargetFile = “D:datatest.rar”

    WshShell.Run RarComponent&” a -ep1 “&TargetFile&” “&SourceFile,0

End Function

 

分享到: 更多

赞(0)
分享到: 更多 (0)
网站地图   沪ICP备18035694号-2    沪公网安备31011702889846号