Run .Exe or .Bat file from C# WPF with arguments
System.Diagnostics.Process.Start() can launch an executable from your program (it could be a Console, WPF or WinForm application).
The Process.Start() has an overload that takes 2 arguments. The first argument is the path of the executable and the second argument takes a string representing the arguments to be passed to the executable.
It's always a good idea to make sure the file exists before you try and launch it with the System.Diagnostics.Process.Start() call.
The Process.Start() has an overload that takes 2 arguments. The first argument is the path of the executable and the second argument takes a string representing the arguments to be passed to the executable.
It's always a good idea to make sure the file exists before you try and launch it with the System.Diagnostics.Process.Start() call.
string ExecutableFilePath = @“C:\Programfiles\OSP\bin\ospdesktop.bat";
string Arguments = @"-appArgs -application com.openspirit.rcp.dataselector.application";
if (File.Exists(ExecutableFilePath ))
System.Diagnostics.Process.Start(ExecutableFilePath , Arguments);
string Arguments = @"-appArgs -application com.openspirit.rcp.dataselector.application";
if (File.Exists(ExecutableFilePath ))
System.Diagnostics.Process.Start(ExecutableFilePath , Arguments);
Comments
Post a Comment