1、你先搞懂 winrar.exe 的解壓參數(shù)格式,然后把winrar.exe和相關(guān)文件加入到資源文件中,然后調(diào)用 資源文件中的winrar.exe
成都創(chuàng)新互聯(lián)主營潁州網(wǎng)站建設(shè)的網(wǎng)絡公司,主營網(wǎng)站建設(shè)方案,成都app軟件開發(fā),潁州h5微信小程序開發(fā)搭建,潁州網(wǎng)站營銷推廣歡迎潁州等地區(qū)企業(yè)咨詢
2、弄明白rar/zip文件解壓/壓縮方法和格式,自己寫程序 (可能會比較麻煩)
如果機器安裝有winRar軟件,就可以通過shell來借用他的功能達到壓縮文件的效果;
參考代碼如下:
Dim DeliveryF As String = Server.MapPath("..\Temp\DeliveryFactors.xls") '原始文件 (壓縮前)
Dim TruckInfo As String = Server.MapPath("..\Temp\TruckInformation.xls")
Dim QDetail As String = Server.MapPath("..\Temp\QuotationDetail.xls")
'用shell命令調(diào)用winrar.exe創(chuàng)建壓縮文件()
Dim winRarexe As String = "C:\Program Files\WinRAR\Rar" 'winzip 執(zhí)行文件的位置
Dim wtarget As String = "C:\temp\QuotationVAComparsion.zip" '目地文件 (壓縮后)
Dim command As String = winRarexe " a " wtarget " " DeliveryF " " TruckInfo " " QDetail
'這個命令你可以查看winrar的命令集
Dim retval As Double 'Shell 指令傳回值
retval = Shell(command, AppWinStyle.MinimizedFocus)
手機敲很累的!一定要給分?。「袷绞牵簍ar 選項 文件.選項有 -c:產(chǎn)生打包文件 -v:顯示詳細信息 -f:指定壓縮后的文件名 -z:打包同時壓縮!舉個例子吧!將目錄my打包并壓縮成my.tar.gz就這樣tar -zcvf my.tar.gz my
1.我有個思路可以嘗試一下:把一張字節(jié)數(shù)在280-300K的圖片用PS打開看看像素大?。?/p>
2.定義一個新的位圖,指定像素大小為上面得到的數(shù)據(jù);
3.讀取你需要修改大小的JPG文件,然后按指定大小復制到上面新建的位圖,并保存為JPG格式
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Text;
using _5dRss.Const;
using _5dRss.lib.Data.Tool;
public partial class admin_admin_dbmanage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//生成備份文件列表
ListBackupFiles();
if (!Page.IsPostBack)
{
Showmsg.Visible = false;
//數(shù)據(jù)庫路徑
lilDBPath.Text = HttpContext.Current.Request.PhysicalApplicationPath + "App_Data\\" + ConfigurationSettings.AppSettings["DBFile"];
//新建一個 FileInfo 對象,并獲得數(shù)據(jù)庫文件的大小,然后轉(zhuǎn)換單位為KB
FileInfo myFileInfo = new FileInfo(lilDBPath.Text);
lilDBSize.Text = Convert.ToString(myFileInfo.Length/1024) + " KB";
//如果兩個參數(shù)都不為空,則繼續(xù)執(zhí)行
if (Request.QueryString["cmd"] != null Request.QueryString["source"] != null)
{
//備份數(shù)據(jù)庫原文件名
string sourceFileName = Request.QueryString["source"];
//如果 cmd 參數(shù)為 DelFile
if (Request.QueryString["cmd"].Equals("DelFile"))
{
//刪除備份數(shù)據(jù)庫文件
File.Delete(HttpContext.Current.Request.PhysicalApplicationPath + "Backup\\" + sourceFileName);
//刷新備份文件列表
ListBackupFiles();
Showmsg.Visible = true;
Showmsg.Text = "div align='center' style='margin-bottom:8px;'img src='images/aL.gif' style='margin-bottom:-6px;'/span class='alertTxt'刪除備份數(shù)據(jù)庫成功!/spanimg src='images/aR.gif' style='margin-bottom:-6px;'//div";
}
//如果 cmd 參數(shù)為 Restore
if (Request.QueryString["cmd"].Equals("Restore"))
{
//用備份文件覆蓋原文件
File.Copy(HttpContext.Current.Request.PhysicalApplicationPath + "Backup\\" + sourceFileName, HttpContext.Current.Request.PhysicalApplicationPath + "App_Data\\" + ConfigurationSettings.AppSettings["DBFile"], true);
//刷新備份文件列表
ListBackupFiles();
Showmsg.Visible = true;
Showmsg.Text = "div align='center' style='margin-bottom:8px;'img src='images/aL.gif' style='margin-bottom:-6px;'/span class='alertTxt'還原備份數(shù)據(jù)庫成功!/spanimg src='images/aR.gif' style='margin-bottom:-6px;'//div";
}
}
}
}
protected void lnkbtnCompactDB_Click(object sender, EventArgs e)
{
//壓縮修復數(shù)據(jù)庫
AccessDBtool.CompactAccessDB(SysConfig.ConnectionString, HttpContext.Current.Request.PhysicalApplicationPath + "App_Data\\" + ConfigurationSettings.AppSettings["DBFile"]);
Showmsg.Visible = true;
Showmsg.Text = "div align='center' style='margin-bottom:8px;'img src='images/aL.gif' style='margin-bottom:-6px;'/span class='alertTxt'壓縮修復數(shù)據(jù)庫成功!/spanimg src='images/aR.gif' style='margin-bottom:-6px;'//div";
}
protected void lnkbtnBackupDB_Click(object sender, EventArgs e)
{
string sourceFileName = HttpContext.Current.Request.PhysicalApplicationPath + "App_Data\\" + ConfigurationSettings.AppSettings["DBFile"];
string destFileName = HttpContext.Current.Request.PhysicalApplicationPath + "Backup\\" + "Backup_";
destFileName += DateTime.Now.ToString("yyyyMMddHHmmss");
destFileName += ".mbk";
//將數(shù)據(jù)庫文件Copy到Backup目錄,如果有重名文件就覆蓋原文件
File.Copy(sourceFileName, destFileName, true);
//生成備份文件列表
ListBackupFiles();
Showmsg.Visible = true;
Showmsg.Text = "div align='center' style='margin-bottom:8px;'img src='images/aL.gif' style='margin-bottom:-6px;'/span class='alertTxt'備份數(shù)據(jù)庫成功!/spanimg src='images/aR.gif' style='margin-bottom:-6px;'//div";
}
/// summary
/// 生成備份文件列表
/// /summary
/// returns文件列表,文件詳細信息及操作選項的HTML代碼/returns
public void ListBackupFiles()
{
//如果目錄不存在則創(chuàng)建次目錄
if (!Directory.Exists(HttpContext.Current.Request.PhysicalApplicationPath + "Backup\\"))
Directory.CreateDirectory(HttpContext.Current.Request.PhysicalApplicationPath + "Backup\\");
DirectoryInfo mydir = new DirectoryInfo(HttpContext.Current.Request.PhysicalApplicationPath + "Backup\\");
StringBuilder sb = new StringBuilder();
foreach (FileInfo f in mydir.GetFiles())
{
sb.Append("a href='backup/" + f.Name + "' target='_blank'img border='0' src='images/mdb.gif' style='margin:4px 3px -3px 0px'/" + f.Name + "/a??a href='?cmd=DelFilesource=" + f.Name + "' title='刪除備份文件'刪除/a | a href='?cmd=Restoresource=" + f.Name + "' title='刪除備份文件'還原數(shù)據(jù)庫/a | " + f.Length/1024 + " KB | " + f.CreationTime + "br /");
}
lilBackupFileList.Text = sb.ToString();
}
}
把下面這句換成你的數(shù)據(jù)庫地址:
//數(shù)據(jù)庫路徑
// lilDBPath.Text = HttpContext.Current.Request.PhysicalApplicationPath + "App_Data\\" + ConfigurationSettings.AppSettings["DBFile"];
function writetxt (filename as string,currenttxt as string) filename ="c:\" filename ".txt" 'filename要生成的文件名 currenttxt當前寫入的文件內(nèi)容. open filename for output As #1 print #1, currenttxt close #1 end functiong sub xxx ... '定義rs為recorder,并生成記錄集, ... rs.movefirst while not rs.eof call writetxt rs.filds("文章標題").value ,rs.filds("文章").value rs.movenext loop '關(guān)閉記錄集等 end sub
當前名稱:vb.net批量壓縮 vb壓縮文件
文章出自:http://chinadenli.net/article26/dodeicg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供App開發(fā)、手機網(wǎng)站建設(shè)、搜索引擎優(yōu)化、、用戶體驗、全網(wǎng)營銷推廣
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)