C# write a simple string from winforms --> cmd prompt telnet -


I have to give a simple string from the command window (floating telnet), ac # vanfarm app ... The easiest way?

I tried the following, but not all or nothing at the time of redirecting standard or input -

the winforms app is not to start CMD window ... CMD window may already be running - I thought how to communicate with it -

Is there 1 or 2 there? '

Please help!

  process p = new process); Serial swift; // Streamrider SR; // StreamReader mistake; ProcessStartInfo psi = New ProcessStart Infos (@ "CMD.exe", @ "/ c Telnet 192.168.0.10"); Private Zero Start {psi.WindowStyle = Process WindowStyle.Normal; Psi.RedirectStandardOutput = false; Psi.RedirectStandardInput = True; Psi.UseShellExecute = false; Psi.CreateNoWindow = false; P.StartInfo = psi; P.Start (); } Private Zero write_to_cmd (Object Sender, EventArgs e) {psi.RedirectStandardInput = true; Sw = p.StandardInput; //// sr = p.StandardOutput; //// err= p.StandardError; //sw.autooflush = true; If (tbComm.Text! = "") Sw.WriteLine (tbComm.Text); //// sw.Close (); ////textBox1.Text = sr.ReadToEnd (); ////textBox1.Text + = err.ReadToEnd (); //p.WaitForExit (); }}  

}

Yes, redirection is all Or nothing, do you want the user to send information to the program along with a command prompt? I think you want to redirect the standard input to Telnet, not at the command prompt.

ProcessStartInfo ("Telnet", "192.168.0.10");

In addition, you can open Telnet instead of the system by using Net.Sockets.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -