国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > 建站經驗 > 正文

C#中使用WinRAR實現加密壓縮 及解壓縮文件

2019-11-02 14:50:53
字體:
來源:轉載
供稿:網友

   本次示例主要實現:

  1.壓縮文件夾及其下文件

  2.壓縮文件夾下文件

  3.壓縮文件夾及其下文件為rar 還是 zip

  4.解壓縮

  5.加密壓縮及解加密壓縮

  -----------

  示例代碼如下:

  ?

 protected void Button1_Click(object sender, EventArgs e)

  {

  string strtxtPath = "C://freezip//free.txt";

  string strzipPath = "C://freezip//free.zip";

  System.Diagnostics.Process Process1 = new System.Diagnostics.Process();

  Process1.StartInfo.FileName = "Winrar.exe";

  Process1.StartInfo.CreateNoWindow = true;

  //// 1

  ////壓縮c:/freezip/free.txt(即文件夾及其下文件freezip/free.txt)

  ////到c:/freezip/free.rar

  //strzipPath = "C://freezip//free";//默認壓縮方式為 .rar

  //Process1.StartInfo.Arguments = " a -r " + strzipPath + " " + strtxtPath;

  //// 2

  ////壓縮c:/freezip/free.txt(即文件夾及其下文件freezip/free.txt)

  ////到c:/freezip/free.rar

  //strzipPath = "C://freezip//free";//設置壓縮方式為 .zip

  //Process1.StartInfo.Arguments = " a -afzip " + strzipPath + " " + strtxtPath;

  //// 3

  ////壓縮c:/freezip/free.txt(即文件夾及其下文件freezip/free.txt)

  ////到c:/freezip/free.zip 直接設定為free.zip

  //Process1.StartInfo.Arguments = " a -r "+strzipPath+" " + strtxtPath ;

  //// 4

  ////搬遷壓縮c:/freezip/free.txt(即文件夾及其下文件freezip/free.txt)

  ////到c:/freezip/free.rar 壓縮后 原文件將不存在

  //Process1.StartInfo.Arguments = " m " + strzipPath + " " + strtxtPath;

  //// 5

  ////壓縮c:/freezip/下的free.txt(即文件free.txt)

  ////到c:/freezip/free.zip 直接設定為free.zip 只有文件 而沒有文件夾

  //Process1.StartInfo.Arguments = " a -ep " + strzipPath + " " + strtxtPath;

  //// 6

  ////解壓縮c:/freezip/free.rar

  ////到 c:/freezip/

  //strtxtPath = "c://freezip//";

  //Process1.StartInfo.Arguments = " x " + strzipPath + " " + strtxtPath;

  //// 7

  ////加密壓縮c:/freezip/free.txt(即文件夾及其下文件freezip/free.txt)

  ////到c:/freezip/free.zip 密碼為123456 注意參數間不要空格

  //Process1.StartInfo.Arguments = " a -p123456 " + strzipPath + " " + strtxtPath;

  //// 8

  ////解壓縮加密的c:/freezip/free.rar

  ////到 c:/freezip/ 密碼為123456 注意參數間不要空格

  //strtxtPath = "c://freezip//";

  //Process1.StartInfo.Arguments = " x -p123456 " + strzipPath + " " + strtxtPath;

  Process1.Start();

  if (Process1.HasExited)

  {

  Response.Write("完成");

  }

  }

  # re: C# (加密)壓縮及解壓縮 相關文件夾及文件

  更多WinRAR命令(引自WinRAR幫助文檔)

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 白河县| 神池县| 丁青县| 鄂温| 江陵县| 阿城市| 科尔| 革吉县| 古丈县| 凯里市| 奉节县| 洛南县| 正阳县| 合肥市| 苏州市| 昆山市| 砚山县| 全南县| 巨鹿县| 普安县| 灌云县| 汽车| 凌源市| 贺州市| 肇源县| 淮滨县| 资阳市| 祁门县| 南川市| 叙永县| 横峰县| 徐闻县| 水富县| 壤塘县| 济宁市| 虎林市| 阿尔山市| 周口市| 丹巴县| 中山市| 巴楚县|