unix - Launch PUTTY script in C# code -
I have to write a C # code that uses the Pootty to connect to a UNIX server, execute a command (for example "ls - la"), and return the results of the script to c #
How can I do this?
I use the process. To run the PUTTY process, start in C #.
What you need to get results from your cyst process, redirect your processes Stream Out (Standard Output)
and consume it in your code:
var processStartInfo = new process restart {filename = @ "c: \ basement location", logic = @ "- SSH -b abc.txt "RedirectStandardOutput = true, UseShellExecute = false, // You must set ShellExecute to a false error ErrorDialog = false}; Var Process = Process Start (processStartInfo); If (process == zero) {return; } Var reader = process.StandardOutput; While (Reader.EndOfStream) {// read data ..}