|
操作电脑文件 解压和压缩
压缩方法
yasuo 压缩文件路径, 被压缩文件路径
如:yasuo "D:\A.rar", "D:\A.txt" '此句把A.txt压缩成A.rar,放到D盘
解压方法
jieya 压缩文件路径, 解压到目标文件夹路径
如:jieya "D:\A.rar", "D:\" '此句把A.rar内文件解压到D盘
调用例子
- Sub 文件压缩测试()
- yasuo "D:\A.rar", "D:\A.txt"
- End Sub
复制代码- Sub 文件解压测试()
- jieya "D:\A.rar", "D:"
- End Sub
复制代码
解压\压缩函数
- Function jieya(rarP$, foderP$)
- Dim exeP$
- exeP = GetSetupPath("WinRAR.exe")
- If exeP = "" Then MsgBox "未安装 WinRAR 软件": Exit Function
- Shell exeP & "\WinRAR.exe X " & rarP & " " & foderP, vbHide
- End Function
- Function yasuo(rarP$, fileP$)
- Dim exeP$
- exeP = GetSetupPath("WinRAR.exe")
- If exeP = "" Then MsgBox "未安装 WinRAR 软件": Exit Function
- Shell exeP & "\WinRAR.exe A -ep " & rarP & " " & fileP, vbHide
- End Function
- Private Function GetSetupPath(AppName As String)
- On Error Resume Next
- Dim Wsh As Object
- Set Wsh = CreateObject("Wscript.Shell")
- GetSetupPath = Wsh.regread("HKEY_LOCAL_MACHINE\Software" & "\Microsoft\Windows\CurrentVersion\App Paths" & AppName & "\Path")
- Set Wsh = Nothing
- End Function
复制代码
|
评分
-
2
查看全部评分
-
|