扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:中国IT实验室 来源:中国IT实验室 2007年10月2日
关键字:
在本页阅读全文(共2页)
后台代码:
using System; using System.Data; using System.Configuration; 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.Runtime.InteropServices; using Microsoft.Win32; using System.Diagnostics; public partial class _Default : System.Web.UI.Page ...{ protected void Page_Load(object sender, EventArgs e) ...{ //清清月儿 http://blog.csdn.net/21aspnet/ } protected void Button1_Click(object sender, EventArgs e) ...{ //压缩 String the_rar; RegistryKey the_Reg; Object the_Obj; String the_Info; ProcessStartInfo the_StartInfo; Process the_Process; try ...{ the_Reg = Registry.ClassesRoot.OpenSubKey("Applications\WinRAR.exe\Shell\Open\Command"); the_Obj = the_Reg.GetValue(""); the_rar = the_Obj.ToString(); the_Reg.Close(); the_rar = the_rar.Substring(1, the_rar.Length - 7); the_Info = " a " + " 1.rar " + " " + "C:\1\1.txt"; the_StartInfo = new ProcessStartInfo(); the_StartInfo.FileName = the_rar; the_StartInfo.Arguments = the_Info; the_StartInfo.WindowStyle = ProcessWindowStyle.Hidden; the_StartInfo.WorkingDirectory = "C:\1";//获取或设置要启动的进程的初始目录。 the_Process = new Process(); the_Process.StartInfo = the_StartInfo; the_Process.Start(); Response.Write("压缩成功"); } catch (Exception ex) ...{ Response.Write(ex.ToString()); } } protected void Button2_Click(object sender, EventArgs e) ...{ //解压缩 String the_rar; RegistryKey the_Reg; Object the_Obj; String the_Info; ProcessStartInfo the_StartInfo; Process the_Process; try ...{ the_Reg = Registry.ClassesRoot.OpenSubKey("Applications\WinRar.exe\Shell\Open\Command"); the_Obj = the_Reg.GetValue(""); the_rar = the_Obj.ToString(); the_Reg.Close(); the_rar = the_rar.Substring(1, the_rar.Length - 7); the_Info = " X " + " 1.rar " + " " + "C:\1"; the_StartInfo = new ProcessStartInfo(); the_StartInfo.FileName = the_rar; the_StartInfo.Arguments = the_Info; the_StartInfo.WindowStyle = ProcessWindowStyle.Hidden; the_Process = new Process(); the_Process.StartInfo = the_StartInfo; the_Process.Start(); Response.Write("解压缩成功"); } catch (Exception ex) ...{ Response.Write(ex.ToString()); } } } |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者