(100分求助)如何调用WinRar加密压缩文件(*.RAR)(在线等) RT,谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 string filePath=@"D:\\test.txt"; System.Diagnostics.Process process = new System.Diagnostics.Process(); process.StartInfo.FileName = "Winrar.exe"; process.StartInfo.CreateNoWindow = true; process.StartInfo.Arguments = string.format("{0} {1}"," a -ep ,filePath); winrar有命令行调用模式,你直接查找命令行的命令格式,然后使用Process调用即可 process.StartInfo.Arguments = string.format("{0} {1}"," a -ep ,filePath);不明白...呵呵 额,我明白, process.StartInfo.Arguments = string.format("{0} {1}"," a -ep ,filePath); 就是写Winrar的运行参数的,前面不知道在Winrar里面什么意思,请按照3楼的找找,第二项就是文件所在目录了,2楼给的演示是压缩那个TXT文件的!!!具体没有试过! 用下面几行代码压缩文件有问题,请帮忙看下,谢谢 private void button1_Click(object sender, EventArgs e) { string filePath=@"E:\\aaa.txt"; string rarPath = @"E:\\aaa.rar"; System.Diagnostics.Process process1 = new System.Diagnostics.Process(); process1.StartInfo.FileName = "Winrar.exe"; process1.StartInfo.CreateNoWindow = true; // process.StartInfo.Arguments = string.Format("{0} {1}", "a -ep", filePath); //加密要所文件 process1.StartInfo.Arguments = "a -p123456" + rarPath + " " + filePath; //解压缩文件 process1.StartInfo.Arguments = "x -p123456" + rarPath + " " + filePath; process1.Start(); process1.WaitForExit(); } "a -p123456" + rarPath之间是不是少了空格? string filePath=@"E:\\aaa.txt"; string rarPath = @"E:\\aaa.rar"; System.Diagnostics.Process process1 = new System.Diagnostics.Process(); process1.StartInfo.FileName = "Winrar.exe"; process1.StartInfo.CreateNoWindow = true; //加密压缩文件 process1.StartInfo.Arguments = "-a -p123456" + rarPath + " " + filePath; process1.Start();//*************************E:\\aaa.txt这个压缩文件格式未知或者数据已经被损坏 string filePath="E:\\aaa.txt"; string rarPath = "E:\\aaa.rar"; 或者string filePath=@"E:\aaa.txt"; string rarPath = @"E:\aaa.rar"; 再试试。 string filePath=@"E:\aaa.txt"; string rarPath = @"E:\aaa.rar"; System.Diagnostics.Process process1 = new System.Diagnostics.Process(); process1.StartInfo.FileName = "Winrar.exe"; process1.StartInfo.CreateNoWindow = true; //加密压缩文件 process1.StartInfo.Arguments = " a -p123456 " + rarPath + " " + filePath; process1.Start();可以啦...谢谢 用进程process控制参数来使用winrar.使用方法就是2,3楼所说的winrar命令 窗体中实现初期建账 Graphics DrawString 怎么在窗体写一个字,和画一个图片 关于初始化窗体 .NET后台设置前台显示问题.偶是新手请大侠帮忙 请教一个正则表达式的写法 OWC中空字符串的问题 明天去买个光驱,进来给个意见,,如果你知道价格,给我个参考 如何写向导程序? 关于c#使用图文混排 c#开发的web网站报错未能加载文件或程序集“IBM.Data.DB2.iSeries 三层传值问题 VC运行错误看不懂
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.FileName = "Winrar.exe";
process.StartInfo.CreateNoWindow = true;
process.StartInfo.Arguments = string.format("{0} {1}"," a -ep ,filePath);
就是写Winrar的运行参数的,前面不知道在Winrar里面什么意思,请按照3楼的找找,第二项就是文件所在目录了,2楼给的演示是压缩那个TXT文件的!!!具体没有试过!
{
string filePath=@"E:\\aaa.txt";
string rarPath = @"E:\\aaa.rar";
System.Diagnostics.Process process1 = new System.Diagnostics.Process();
process1.StartInfo.FileName = "Winrar.exe";
process1.StartInfo.CreateNoWindow = true; // process.StartInfo.Arguments = string.Format("{0} {1}", "a -ep", filePath); //加密要所文件
process1.StartInfo.Arguments = "a -p123456" + rarPath + " " + filePath; //解压缩文件
process1.StartInfo.Arguments = "x -p123456" + rarPath + " " + filePath;
process1.Start();
process1.WaitForExit();
}
string rarPath = @"E:\\aaa.rar";
System.Diagnostics.Process process1 = new System.Diagnostics.Process();
process1.StartInfo.FileName = "Winrar.exe";
process1.StartInfo.CreateNoWindow = true; //加密压缩文件
process1.StartInfo.Arguments = "-a -p123456" + rarPath + " " + filePath;
process1.Start();
//*************************
E:\\aaa.txt
这个压缩文件格式未知或者数据已经被损坏
string rarPath = "E:\\aaa.rar"; 或者
string filePath=@"E:\aaa.txt";
string rarPath = @"E:\aaa.rar";
再试试。
string rarPath = @"E:\aaa.rar";
System.Diagnostics.Process process1 = new System.Diagnostics.Process();
process1.StartInfo.FileName = "Winrar.exe";
process1.StartInfo.CreateNoWindow = true; //加密压缩文件
process1.StartInfo.Arguments = " a -p123456 " + rarPath + " " + filePath;
process1.Start();
可以啦...谢谢
winrar命令