Windows Develop Bookmark and Share   
 index > Windows Forms Sample Applications > RAR
 

RAR

hi,

im using the following command to give parameters to WinRar.exe:

string cmdArgs = string.Format("A {0} {1}", @"F:\test\daemon\daemon4304-lite", @"F:\test\daemon\daemon4304-lite.exe")

but when the program runs winrar creates a "rar" that starts from test directory inseteade of just raring the file I want.

How can I do to make WinRar.exe rar only the file I want
thanks in advance
drini  Wednesday, September 09, 2009 12:49 PM
Hi drini,

We can change the current directory to the directory which contains the file needs to be packaged, then call the WinRAR command to package the file. For example, the command can be as follows:
cd C:\Users\v-shunli\Documents\MyFile
"C:\Program Files (x86)\WinRAR\WinRAR.exe" A "test.rar" "Rad.RegexDesigner.Setup.1.4.exe"

We can also follow the code snippet below to change the current directory programmatically:
System.IO.Directory.SetCurrentDirectory(@"C:\Users\v-shunli\Documents\MyFile");

Let me know if this does not help.
Aland Li

Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
  • Marked As Answer bydrini Monday, September 14, 2009 9:12 AM
  •  
Aland Li  Monday, September 14, 2009 9:00 AM
Hi drini,

This thread shows how to use winrar indetail in command:
http://social.msdn.microsoft.com/Forums/en-US/winformsapplications/thread/a34c88be-1174-4899-9ff1-039098257d85.

Regards,
Aland Li
Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
Aland Li  Friday, September 11, 2009 5:14 AM
thank you for the reply but it is because that im following that thread that im having problem.

the command described into that thread when i "Run" it it puts into the "RAR" all the path starting from the HD part where it is allocated, ex: D:\..\...\..file.rar or C:\....file.rar

what i want to create is just file.rar

thanks in advance
drini  Monday, September 14, 2009 8:08 AM

Hi drini,

In your code snippet, the parameters are:

1. @"F:\test\daemon\daemon4304-lite"

2. @"F:\test\daemon\daemon4304-lite.exe�/span>

The first parameter is the rar file path and the second parameter is the files which need to be packaged. So we need to change the first parameter to
@"F:\test\daemon\daemon4304-lite.rar"

Please read the reply I posted at Thursday, July 30, 2009 7:19 AM which includes some examples in this thread: http://social.msdn.microsoft.com/Forums/en-US/winformsapplications/thread/a34c88be-1174-4899-9ff1-039098257d85.

Let me know if this does not help.
Aland Li


Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
Aland Li  Monday, September 14, 2009 8:24 AM
same thing the situation didn't change, it created daemon4304-lite.rar which has test=>daemon=>daemon.exe inside it what i need is just daemon.exe to be inside.

and as for the your original post i have read and studied it but still it give me the same rezult
drini  Monday, September 14, 2009 8:39 AM
Hi drini,

We can change the current directory to the directory which contains the file needs to be packaged, then call the WinRAR command to package the file. For example, the command can be as follows:
cd C:\Users\v-shunli\Documents\MyFile
"C:\Program Files (x86)\WinRAR\WinRAR.exe" A "test.rar" "Rad.RegexDesigner.Setup.1.4.exe"

We can also follow the code snippet below to change the current directory programmatically:
System.IO.Directory.SetCurrentDirectory(@"C:\Users\v-shunli\Documents\MyFile");

Let me know if this does not help.
Aland Li

Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
  • Marked As Answer bydrini Monday, September 14, 2009 9:12 AM
  •  
Aland Li  Monday, September 14, 2009 9:00 AM
thanks it worked out
drini  Monday, September 14, 2009 9:13 AM

You can use google to search for other answers

Custom Search

More Threads

• ??record video stream??
• Unable to Install TV Server on Windows Server 2003 Std.
• Complete overhaul of Task vision Web service Layer
• How to get a thumbnail image for a screen shots for a website
• Unable to locate the localhost database
• Code released for .NET Terrarium?
• Is it dead?
• Observer/Subject Pattern
• How to get the directory (folder) on which user has done right click
• TaskVision: Danger of BadPractices