c# - How to write on Putty Console -


i tried many things , don't work on putty, work notepad or cmd.

i tried using sendkeys , redirectstandardinput. else can try?

// import function in class     [dllimport("user32.dll")]     static extern int setforegroundwindow(intptr point);      public form1()     {         initializecomponent();         runputty();     }      private void runputty()     {         processstartinfo cmd = new processstartinfo();         cmd.filename = @"putty.exe";         cmd.useshellexecute = false;         cmd.redirectstandardinput = true;         cmd.redirectstandardoutput = true;         cmd.arguments = "-ssh user@192.168.127.129 22 -pw password";          using (process process = process.start(cmd))         {             process.waitforinputidle();             intptr h = process.mainwindowhandle;             setforegroundwindow(h);             sendkeys.sendwait("ls");             process.waitforexit();         }     } 

is there better way automate process using multiple commands on server via putty? wanted use putty.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -