Thứ Ba, 9 tháng 7, 2013

nén file sử dụng winrar và c# / compress file using winrar and c#

static void Main()
{
        string input = "c:/home/chieu/input.txt";
        string input1 = "c:/home/chieu/input1.txt";
        string output = "c:/home/chieu/output.rar";
        string exePath = "C:/Program Files (x86)/Winrar/winrar.exe    ";//64bit
        // string exePath = "C:/Program Files/Winrar/winrar.exe       ";//32bit
        string args = "  a   " + output + "  " + input + "   " + input1;
        Process proc = new Process();

        proc.StartInfo.FileName = exePath;

        proc.StartInfo.Arguments = args;

        proc.StartInfo.CreateNoWindow = true;

        // proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

        // proc.StartInfo.ErrorDialogParentHandle = (IntPtr) ;

        proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
        proc.Start();

        proc.WaitForExit();
}

Không có nhận xét nào:

Đăng nhận xét