Essentially what I want to do is be able to take a string
byte[] RecPacket = new byte[1000];
//Read a command from the client.
Receiver.Read(RecPacket, 0, RecPacket.Length);
//Flush the receiver
Receiver.Flush();
//Convert the packet into a readable string
string Command = Encoding.ASCII.GetString(RecPacket);
and have the application put it into the command line itself without the user doing it. As far as the research I've done I cannot find a way to directly do that. I found a roundabout way in which you do this
switch (Command)
{
case "SHUTDOWN":
string shutdown = Command;
//Shuts it down
System.Diagnostics.Process SD = new System.Diagnostics.Process();
SD.StartInfo.FileName = "shutdown -s";
SD.Start();
break;
}
but that doesn't seem to work and it also doesn't allow you to do any command available in the windows command line. My goal is to remotely access the command line and be able to send any command to it. Can someone help me out with this?