D
D
Denis2016-01-31 09:40:15
Programming
Denis, 2016-01-31 09:40:15

How to run an exe file with a parameter in C# applications?

Good day to all!
Tell me, please, how can I run the exe file from the application in c#?
Here is the code, but for some reason it doesn't work. The launch line should be: Extractor.exe "base\sql" "develop" "..\Data\System" "Grids"

public static void StartExtractor()
        {
            System.Diagnostics.Process process = new System.Diagnostics.Process();
            process.StartInfo.FileName = OurFields.keskullPass + @"\Extractor.Deploy\Extractor.exe";
            process.StartInfo.Arguments = "\"base\\sql\" \"develop\" \"..\\Data\\System\" \"Grids\"";
            process.Start();
            process.WaitForExit();
        }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Peter, 2016-01-31
@petermzg

So ProcessStartInfo should be passed as a parameter to Process.Start

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;
Process.Start(startInfo)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question