求一个vbs

来源:百度知道 编辑:UC知道 时间:2024/07/04 18:13:59
获取e:\非是非非\下所有文件的文件名,生成txt文件,并压缩,加密码为123456.最后在桌面生成abc.rar
感激不尽,做得好我再追加50分

我要的是压缩的是txt,而不是非是非非下的所有文件!!

先谢谢各位了

Option Explicit

Main "e:\非是非非", _
CreateObject("WScript.Shell").SpecialFolders("Desktop") & "\abc.rar", _
"123456"

Sub Main(sFolderPath, sRarPath, sPass)
Const LIST_FILE = "_list.txt"
SaveToFile GetFilePath(sFolderPath, True), LIST_FILE
Rar LIST_FILE, sRarPath, sPass
CreateObject("Scripting.FileSystemObject").DeleteFile LIST_FILE
WSH.Echo "Done!"
End Sub

Sub Rar(sSrc, sDst, sPass)
With CreateObject("WScript.Shell")
.Run """" & _
.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\" & _
"Windows\CurrentVersion\App Paths\winrar.exe\") & _
""" a -hp" & sPass & " """ & sDst & """ """ & sSrc & """", 0, True
End With
E