Reputation: 195
(...)
Session sess = new Session();
sess.Open(sessionParams);
(...)
sess.ExecuteCommand('/home/kit/count.sh').Check();
Using WinSCP .NET assembly I create a connection to my Linux host and execute a script. My problem is to catch result of script to C# variable. In this case is just a single string. I've found a properties of session object called output but I am really do not know how to use it.
Would you help me please
Upvotes: 2
Views: 1876
Reputation: 202360
The Session.ExecuteCommand
method returns an instance of CommandExecutionResult
.
The CommandExecutionResult
has a property Output
.
CommandExecutionResult result = sess.ExecuteCommand('/home/kit/count.sh');
result.Check();
string output = result.Output;
Upvotes: 2