What is the C# equivalent of the VB.NET Shell command?

Here's the code I need an equivalent for:

            Shell("C:\Program Files\WinZip\wzzip -sPa$$pHr@$E47 -ycAES256 " & Left(fil.Path, fil.Path.Length - 4) & ".zip " & fil.Path, AppWinStyle.NormalFocus, True, 60000)

LVL 1
FrancineTaylorAsked:
Who is Participating?
 
DarrenMcCallCommented:
jcoehoorn: yes! I keep leaving code off!
shell.Start();
shell.WaitForExit; //If you want to wait

Open in new window

0
 
DarrenMcCallCommented:
What does the "true" and "60000" do?
using System.Diagnostics;
 
Process shell = new Process();
shell.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
shell.StartInfo.FileName = "C:\Program Files\WinZip\wzzip.exe";
shell.StartInfo.Arguments = "-sPa$$pHr@$E47 -ycAES256 " & Left(fil.Path, fil.Path.Length - 4) & ".zip " & fil.Path;

Open in new window

0
 
David H.H.LeeCommented:
Hi FrancineTaylor,
You can try this:
Interaction.Shell("C:\\Program Files\\WinZip\\wzzip -sPa$$pHr@$E47 -ycAES256 " + Strings.Left(fil.Path, fil.Path.Length - 4) + ".zip " + fil.Path, AppWinStyle.NormalFocus, true, 60000);

Here is the convertor from C# to vb.net. You can try it for other conversion as well.
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
DarrenMcCallCommented:
Sorry, I forgot to use escape characters
shell.StartInfo.FileName = "C:\\Program Files\\WinZip\\wzzip.exe";

Open in new window

0
 
DarrenMcCallCommented:
correction to the last line
shell.StartInfo.Arguments = "-sPa$$pHr@$E47 -ycAES256 " + shell.StartInfo.FileName.Substring(0, shell.StartInfo.FileName.Length - 4) + ".zip " + shell.StartInfo.FileName;

Open in new window

0
 
Joel CoehoornDirector of Information TechnologyCommented:
Use the System.Diagnostics.Process() class:
Process.Start()
0
 
FrancineTaylorAuthor Commented:
Aha!  Thank you, Darren, I was just composing another question...you just answered it!

You guys are great, thanks!
0
 
FrancineTaylorAuthor Commented:
Thanks again!  You're awesome.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.