文件是压缩成功了.
代码如下:the_Reg = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\WinRAR.exe");
the_Obj = the_Reg.GetValue("");
the_rar = the_Obj.ToString();
the_Reg.Close(); if (!Directory.Exists(UnRarPatch))
{
Directory.CreateDirectory(UnRarPatch);
} the_Info = string.Format("a {0} {1} -r", "e:\\ttt\\3d.zip", "e:\\ttt\\tttt"); using (Process unrar = new Process())
{
unrar.StartInfo.FileName = the_rar;
unrar.StartInfo.Arguments = the_Info;
unrar.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
unrar.Start();
unrar.WaitForExit();
unrar.Close();
}
现在的问题是:压缩的包:3d.zip 里面的路径是从E盘ttt开始算起的,我需要的结果就是直接是当前文件夹“tttt”,我试了n种方式都不行。
代码如下:the_Reg = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\WinRAR.exe");
the_Obj = the_Reg.GetValue("");
the_rar = the_Obj.ToString();
the_Reg.Close(); if (!Directory.Exists(UnRarPatch))
{
Directory.CreateDirectory(UnRarPatch);
} the_Info = string.Format("a {0} {1} -r", "e:\\ttt\\3d.zip", "e:\\ttt\\tttt"); using (Process unrar = new Process())
{
unrar.StartInfo.FileName = the_rar;
unrar.StartInfo.Arguments = the_Info;
unrar.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
unrar.Start();
unrar.WaitForExit();
unrar.Close();
}
现在的问题是:压缩的包:3d.zip 里面的路径是从E盘ttt开始算起的,我需要的结果就是直接是当前文件夹“tttt”,我试了n种方式都不行。
换成
Application.StartupPath
就是我压缩成功后,打开3d.zip这个包,里面的路径是从E盘ttt文件夹开始的,我需要的结果是直接从“tttt”文件夹开始。
拿我的路径和文件夹举例子,效果要和右键“添加到压缩文件“tttt.rar””效果一样.