I'm trying to make a program that runs several command prompt console commands after clicking a button
(in this case, "sc \\testserver01 stop spooler" and the like. Failing that, I have several batch files
written up but I do not want them in any way to be physically on the server without them being encoded
into the executable if possible. Is there a way to either run the command prompt commands or an embedded
batch file? I have included some code that runs the batch file fine if I place it locally with the executable,
I can change the path as well and even have it download from other servers or URLS... but that's not what I need.
Any advice?
private void button1_Click(object sender, EventArgs e)
{
//Restarts Print Spooler on Testserver01
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents = false;
proc.StartInfo.FileName = "t1.bat";
proc.Start();
}
View Complete Post