public static void LaunchCommandLineApp(string command, string args)
{
// Use ProcessStartInfo class
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.CreateNoWindow = false;
startInfo.UseShellExecute = false;
startInfo.FileName = command;
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.Arguments = args;
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.
}
}
Sunday, 30 November 2014
C# run DOS command
Labels:
Coding,
CSharp,
Programming
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment