Last post Mar 07, 2008 12:41 AM by Azamat
Member
60 Points
90 Posts
Feb 20, 2008 07:28 AM|neeraja.dotnet|LINK
hi can any one tell me how to run command prompt commands from c# coding
Contributor
4254 Points
1436 Posts
Feb 20, 2008 08:18 AM|rjcox|LINK
System.Diagnostics provides types to help.
Including redirection of standard input/output/error.
See thread http://forums.asp.net/t/1222335.aspx for an example.
1 Points
10 Posts
Mar 07, 2008 12:41 AM|Azamat|LINK
Hi!! Try this. it starts a Window service from command prompt.
System.Diagnostics.ProcessStartInfo si = new System.Diagnostics.ProcessStartInfo("cmd.exe");
si.RedirectStandardInput = true;
si.RedirectStandardOutput = true;
si.RedirectStandardError = true;
si.UseShellExecute = false;
si.CreateNoWindow = true;
si.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
System.Diagnostics.Process console = System.Diagnostics.Process.Start(si);
console.StandardInput.WriteLine(@"/C net start ""MonitorWebSite"" ");
Member
60 Points
90 Posts
how to run command prompt commands from c# programming
Feb 20, 2008 07:28 AM|neeraja.dotnet|LINK
hi can any one tell me how to run command prompt commands from c# coding
Contributor
4254 Points
1436 Posts
Re: how to run command prompt commands from c# programming
Feb 20, 2008 08:18 AM|rjcox|LINK
System.Diagnostics provides types to help.
Including redirection of standard input/output/error.
See thread http://forums.asp.net/t/1222335.aspx for an example.
Member
1 Points
10 Posts
Re: how to run command prompt commands from c# programming
Mar 07, 2008 12:41 AM|Azamat|LINK
Hi!! Try this. it starts a Window service from command prompt.
System.Diagnostics.ProcessStartInfo si = new System.Diagnostics.ProcessStartInfo("cmd.exe");
si.RedirectStandardInput = true;
si.RedirectStandardOutput = true;
si.RedirectStandardError = true;
si.UseShellExecute = false;
si.CreateNoWindow = true;
si.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
System.Diagnostics.Process console = System.Diagnostics.Process.Start(si);
console.StandardInput.WriteLine(@"/C net start ""MonitorWebSite"" ");