2
(...)
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

1 Answer 1

2

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;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.