你昨天不是问过几乎一样的问题吗?压缩文件夹只需要将文件名改为文件夹名称即可。Option Explicit
Dim strRARPath As String
Dim strCompresFile As String '要压缩的文件路径
Dim strTargetFile As String '压缩后的文件路径
Dim retval
Private Sub Command1_Click()
Dim strP As String
Dim lngP As Long
strRARPath = "C:\Program Files\WinRAR\winrar.exe" '执行压缩的可执行文件路径
strCompresFile = "C:\1" '要压缩的文件路径
strTargetFile = "C:\1.rar" '压缩后的文件路径
strP = strRARPath & " A " & strTargetFile & " " & strCompresFile '压缩命令字符串
lngP = Shell(strP, vbHide) '执行压缩命令
End Sub
Private Sub Command2_Click()
Dim strP As String
Dim lngP As Long
strRARPath = "C:\Program Files\WinRAR\winrar.exe"
strTargetFile = "C:\1.rar" '压缩文件路径
strCompresFile = "C:\1\" '解压缩后文件的位置
strP = strRARPath & " X " & strTargetFile & " " & strCompresFile
lngP = Shell(strP, vbHide)
End Sub
Dim strRARPath As String
Dim strCompresFile As String '要压缩的文件路径
Dim strTargetFile As String '压缩后的文件路径
Dim retval
Private Sub Command1_Click()
Dim strP As String
Dim lngP As Long
strRARPath = "C:\Program Files\WinRAR\winrar.exe" '执行压缩的可执行文件路径
strCompresFile = "C:\1" '要压缩的文件路径
strTargetFile = "C:\1.rar" '压缩后的文件路径
strP = strRARPath & " A " & strTargetFile & " " & strCompresFile '压缩命令字符串
lngP = Shell(strP, vbHide) '执行压缩命令
End Sub
Private Sub Command2_Click()
Dim strP As String
Dim lngP As Long
strRARPath = "C:\Program Files\WinRAR\winrar.exe"
strTargetFile = "C:\1.rar" '压缩文件路径
strCompresFile = "C:\1\" '解压缩后文件的位置
strP = strRARPath & " X " & strTargetFile & " " & strCompresFile
lngP = Shell(strP, vbHide)
End Sub
解决方案 »
- 免费下载《Visual Basic 应用软件开发规范》电子文档
- 数据统计
- 有没有更好更简便的方法(与MSSQL数据库的主键有关)
- 用VB+SQL server2000做的企业人事信息管理系统 有偿求助
- 请问哪里有VB软件下载,谢谢了
- 大家快来看看呀,sql 语名出错,总说insert语法错误
- 在VB中怎样调用一个SQLSERVER带参数的存储过程(返回满足条件的记录),并将结果记录集在VB窗体中的DATAGRID1表格中显示出来??谢谢了?
- 有关timeout的问题
- 如何控制鼠标的指针在屏幕上移动!
- 如何得到一个文件夹的所有子文件夹和文件?
- 要学习VB6.0,跪求个初学者入门的资料.
- recordset在查询左外联结返回结果有误
WshShell.Run("winrar A D:\1.rar d:\201202151759")
这种方法进行压缩,压缩后解压出来是带文件夹的,但我须要的是不带文件夹的,我不知道我表达清楚了没,有这种方法吗
WshShell.Run("winrar A D:\1.rar d:\201202151759")改成
WshShell.Run("winrar A D:\1.rar d:\201202151759\*") 即可