110,534
社区成员
发帖
与我相关
我的任务
分享
string strtxtPath = "C:\\freezip\\free.txt";
string strzipPath = "C:\\freezip\\free.rar";
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;
private void button1_Click(object sender, EventArgs e)
{
string strtxtPath = "C:\\freezip\\free";
string strzipPath = "C:\\freezip\\free.rar";
System.Diagnostics.Process process1 = new System.Diagnostics.Process();
process1.StartInfo.WorkingDirectory = @"C:\Program Files\WinRAR";
process1.StartInfo.FileName = "WinRAR.exe";
process1.StartInfo.CreateNoWindow = true;
//// process1.start();//当启动该方法的时候 会弹出rar的压缩文件的对话框 下面的内容不在执行
////压缩c:\freezip\free.txt(即文件夹及其下文件freezip\free.txt)
////到c:\freezip\free.rar
process1.StartInfo.Arguments = " a " + strzipPath + " " + strtxtPath + " -r ";
}
private void button1_Click(object sender, EventArgs e)
{
string strtxtPath = "C:\\freezip\\free.txt";
string strzipPath = "C:\\freezip\\free.rar";
System.Diagnostics.Process process1 = new System.Diagnostics.Process();
process1.StartInfo.FileName = @"C:\Program Files\WinRAR\WinRAR.exe";
process1.StartInfo.CreateNoWindow = true;
//// process1.start();//当启动该方法的时候 会弹出rar的压缩文件的对话框 下面的内容不在执行
////压缩c:\freezip\free.txt(即文件夹及其下文件freezip\free.txt)
////到c:\freezip\free.rar
strzipPath = "C:\\freezip\\free";//默认压缩方式为 .rar
process1.StartInfo.Arguments = " a -ibck -r " + strzipPath + " " + strtxtPath;
}