How do I run an external program like Notepad or Calculator via a C# program?
I am new to it and I can't seem to get it correct.
How do I run an external program like Notepad or Calculator via a C# program?
I am new to it and I can't seem to get it correct.
Use System.Diagnostics.Process.Start
Probable duplicate of: How to start a process from C# (WinForms)
For example like this :
// run notepad
System.Diagnostics.Process.Start("notepad.exe");
//run calculator
System.Diagnostics.Process.Start("calc.exe");
Follow the links in Mitchs answer.
Hi this is Sample Console Application to Invoke Notepad.exe ,please check with this.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
namespace Demo_Console
{
class Program
{
static void Main(string[] args)
{
Process ExternalProcess = new Process();
ExternalProcess.StartInfo.FileName = "Notepad.exe";
ExternalProcess.StartInfo.WindowStyle = ProcessWindowStyle.Maximized;
ExternalProcess.Start();
ExternalProcess.WaitForExit();
}
}
}