Finding yourself in the ssh component will allow you to do more meaningful things, but at a basic level, you can do something like this:
public void ExecuteExternalCommand(string command)
{
try
{
System.Diagnostics.ProcessStartInfo processStartInfo = new System.Diagnostics.ProcessStartInfo("cmd", "/c " + command);
processStartInfo.RedirectStandardOutput = true;
processStartInfo.UseShellExecute = false;
processStartInfo.CreateNoWindow = true;
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo = processStartInfo;
process.Start();
string output = process.StandardOutput.ReadToEnd();
Console.WriteLine(output);
}
catch (Exception exception)
{
}
}
Allows you to run arbitrary external executable files through the cmd.exe interface, and then respond to it.
Here are some links:
source
share