Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Diagnostics;
- class Program
- {
- static void Main()
- {
- //
- // Use Process.Start here.
- //
- Process.Start("C:\");
- }
- }
- using System.Diagnostics;
- class Program
- {
- static void Main()
- {
- LaunchCommandLineApp();
- }
- /// <summary>
- /// Launch the legacy application with some options set.
- /// </summary>
- static void LaunchCommandLineApp()
- {
- // For the example
- const string ex1 = "C:\";
- const string ex2 = "C:\Dir";
- // Use ProcessStartInfo class
- ProcessStartInfo startInfo = new ProcessStartInfo();
- startInfo.CreateNoWindow = false;
- startInfo.UseShellExecute = false;
- startInfo.FileName = "dcm2jpg.exe";
- startInfo.WindowStyle = ProcessWindowStyle.Hidden;
- startInfo.Arguments = "-f j -o "" + ex1 + "" -z 1.0 -s y " + ex2;
- try
- {
- // Start the process with the info we specified.
- // Call WaitForExit and then the using statement will close.
- using (Process exeProcess = Process.Start(startInfo))
- {
- exeProcess.WaitForExit();
- }
- }
- catch
- {
- // Log error.
- }
- }
- }
- //The below mentioned code worked for me.
- Process process = new Process();
- //Specify the working directory.
- process.StartInfo.WorkingDirectory = @"E:Source";
- process.StartInfo.FileName = "Internet.exe";
- // 3 arguments, space separated
- // configfile imagefilename ocrfilename
- process.StartInfo.Arguments = "Arguments"; //Pass the arguments with delimiters
- process.StartInfo.UseShellExecute = false;
- process.StartInfo.CreateNoWindow = true;
- process.Start();
- process.WaitForExit();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement