Link to home
Start Free TrialLog in
Avatar of FrancineTaylor
FrancineTaylor

asked on

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)

Avatar of DarrenMcCall
DarrenMcCall
Flag of United States of America image

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

Avatar of David H.H.Lee
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.
Sorry, I forgot to use escape characters
shell.StartInfo.FileName = "C:\\Program Files\\WinZip\\wzzip.exe";

Open in new window

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

Use the System.Diagnostics.Process() class:
Process.Start()
ASKER CERTIFIED SOLUTION
Avatar of DarrenMcCall
DarrenMcCall
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of FrancineTaylor
FrancineTaylor

ASKER

Aha!  Thank you, Darren, I was just composing another question...you just answered it!

You guys are great, thanks!
Thanks again!  You're awesome.