(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命令 DevExpress GaugeControl一个属性有用过的吗? 关于LRC 校验码函数取模的问题 C# Form treeView 点击节点触发事件是什么? datagrid 如何选中一行,选中的行背景颜色更改。 VB转换C# 谁有在Mobile 5.0下面使用移动设备组件 opennetcf资料. 各位大哥!为何不能使用System.Management命名空间? 我用SERVER来传递页面参数值 可以看到传递值成功但是提示错误 up有分 初学者的问题:我在学习C#语法,怎么编C#的console程序。 三层传值问题 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命令