日期:2014-05-17 浏览次数:21286 次
<% s_path=server.mappath("./")&"\" Set WshShell = Server.CreateObject("WScript.Shell") IsSuccess = WshShell.Run ("winrar a -pABC "&s_path&"\abc.rar "&s_path&"\Book1.xls",1, False) if IsSuccess = 0 Then Response.write "成功压缩!" else Response.write "压缩失败!权限不够或者该程序无法运行" end if %>
------解决方案--------------------
如果觉得压缩路径太深可以省略路径:
WshShell.Run ("winrar a -pABC -ep "&s_path&"\abc.rar "&s_path&"\Book1.xls",1, False)
// -ep表示压缩文件时不会包含路径信息(压缩多个文件时注意不要同名哦)