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

The SDK directory does not exist (ubuntu 16.04) (react native) -

python - How to clone or copy a list? -

python - How to use Celery in Tornado with redis as broker and backend? -