# C# program with WinRAR

Page 1 of 1

## 4 Replies - 9345 Views - Last Post: 17 September 2009 - 12:47 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=125700&amp;s=1fb718572a8f55d75175454f4590f903&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 dunk_6

• New D.I.C Head

Reputation: 1
• Posts: 43
• Joined: 03-August 09

# C# program with WinRAR

Posted 14 September 2009 - 02:12 AM

Hi all,

I want to design a c# program which can run WinRAR. the program will browse for file and send the with a button, the process to create archive will begin..!

I know using System.Diagnostics.Process.Start method can execute the exe file. for eg.

Process.Start(@"C:\path\to\file.zip")


GetFile("filename","open winrar to execute the file") I need something like this. How should i start? Any references/solution are very thankful.

thank you very much.

Is This A Good Question/Topic? 0

## Replies To: C# program with WinRAR

### #2 MentalFloss

Reputation: 526
• Posts: 1,397
• Joined: 02-September 09

## Re: C# program with WinRAR

Posted 14 September 2009 - 08:57 AM

I don't use WinRAR, so I cannot fully confirm this site, but try creating the process start directly to the rar tool and making the path to extract part of the arguments.
Here is the command line usage of winrar:
http://www.respower...._tutorial_unrar

If you need actual code to do this, just ask. I think you'll be able to manage this though.

Hopefully this helps.

### #3 dunk_6

• New D.I.C Head

Reputation: 1
• Posts: 43
• Joined: 03-August 09

## Re: C# program with WinRAR

Posted 16 September 2009 - 06:51 PM

MentalFloss, on 14 Sep, 2009 - 07:57 AM, said:

Here is the command line usage of winrar:
http://www.respower...._tutorial_unrar
Hopefully this helps.

I'm kind of understand but i don't know how to run it. I'm using Vista, do i need to change into WINXP to run it?

Quote

If you need actual code to do this, just ask. I think you'll be able to manage this though.

the actual code? it would great if u can give me.

Thank you very much.

### #4 PsychoCoder

Reputation: 1641
• Posts: 19,853
• Joined: 26-July 07

## Re: C# program with WinRAR

Posted 16 September 2009 - 07:31 PM

Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Post your code like this:

Thanks.

### #5 dunk_6

• New D.I.C Head

Reputation: 1
• Posts: 43
• Joined: 03-August 09

## Re: C# program with WinRAR

Posted 17 September 2009 - 12:47 AM

Quote

Here is the command line usage of winrar:
http://www.respower...._tutorial_unrar
Hopefully this helps.

This is one part of the program..
This code open all WinRAR program if not error occur. I put this in button, and checking of file is given in txtDest.text using browse folder. So instead of open, i want it to be execute(compress) directly.

ProcessStartInfo startInfo = new ProcessStartInfo("WinRAR.exe");
startInfo.WindowStyle = ProcessWindowStyle.Maximized;
startInfo.Arguments = txtDest.Text;
try
{
// Call WaitForExit and then the using statement will close.
using (Process exeProcess = Process.Start(startInfo))
{
exeProcess.WaitForExit();
}
}
catch
{
MessageBox.Show("Error Open");
}



This post has been edited by dunk_6: 17 September 2009 - 01:35 AM