How to run Self extracting ZIP file from C# Application

R

Ravi

Iam trying to open an self extracting zip file from my windows
application. it opens an command window and does not do any thing
afterwards. here is the code iam doing it.

System.Diagnostics.Process proc = new
System.Diagnostics.Process();
proc.EnableRaisingEvents = false;
proc.StartInfo.FileName = filename;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.UseShellExecute = false;
proc.Start();

Thanks
Ravi
 
N

Nicholas Paldino [.NET/C# MVP]

Ravi,

You want to set UseShellExecute to true, I believe, so that the OS
handles the call (instead of having the os execute the file directly).

Hope this helps.
 
R

Ravi

Nicholas,

Itried to setting
proc.StartInfo.UseShellExecute = true

but it still doesnot work.

Thanks
Ravi
 
P

Peter Bromberg [MVP]

Ravi,
are you sure that the "filename" field holds the FULL path to the file?
e.g., filename = @"C:\Temp\myzip.exe";

This works fine for me using your exact code snippet.
Peter
 
R

Ravi

Nicholas,

Iam passing filename="C:\\test\\myzip.exe"
It still not working.

The workaround i found is i created a batch file which takes the path
and file name as input parametes and runs the file. And i call the
batch file from code.

Thanks
Ravi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top