首先,你要装Winrar
要把整个用法都写出来也是挺长的(参阅C:\Program Files\Winrar\Rar.txt 47,855 字节来讲RAR的命令行)
简单说
Const WinRAR = "C:\Program Files\Winrar\" 'winrar安装地址,要带\
Const Path1 = "c:\1.txt" '要压缩的文件,路径带空格的话在外面多套两对双引号
Const Path2 = "c:\2.txt" '要压缩的文件,同上
Const RarPath = "c:\3.rar" '生成的压缩文件名,同上
Private Sub Command1_Click()
Shell WinRAR & "rar.exe a " & RarPath & " " & Path1 & " " & Path2
End Sub
参考winrar参数,用shell调用
http://www.acnis.com/modules.php?name=ArticlE&file=article&sid=23