Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Scripting in VB.Net

You cannot do this with WinSCP.
M.R.

Scripting in VB.Net

Hello,
Sorry for the late reply. I am using ver. 4.2.6
I think some clarification is needed. When I mentioned that 'execution continues' I was referring to execution of scripting commands in a VB.Net procedure. . I would like to have a way in Visual Basic.Net to trap errors that may occur in scripting and stop the execution at any point in my procedure...
Something like a 'return code' or maybe to have a complete error description in the xml log file.

Regards,
M. Rusu
martin

I wasn't able to reproduce your problem.

What version of WinSCP are you using?

If you have the latest one, create simple script file with:
option batch abort
option confirm off
open ....
put ....

Run the script and post the output of the script.
Guest

Thank you for your answer.
I have set 'Option Batch Abort' in the VB.Net procedure but bothing happens if there is an error connecting to Unix. Execution just continues.

Here is my VB.Net code:

With oWinscp
' Feed in the scripting commands
.StandardInput.WriteLine("option batch abort")
.StandardInput.WriteLine("option confirm off")

'connect to Oracle directory
.StandardInput.WriteLine("open sftp://...user, password ...."
end with
more scripting commands....

How can I trap the error in VB.net if let's say the password is expired?

Regards,
M. Rusu
martin

Re: Scripting feature

If you use "option batch abort", the scripts stops on any error and you can handle the situation as you like.
M. Rusu

Scripting feature

Hello,

I would like to suggest implementing an enhanced scripting error handling. I want to be able for example to tell if an OPEN sftp command was successful or not.

This especially is very critical in our corporate environment. Let me explain why: if an user password has expired and he /she keeps trying to connect to the remote UNIX directory using our VB.net application, then the account locks and it may take a couple of days to unlock it. There are many steps to execute in the code, like moving, renaming files, etc. Not all of these steps can be checked for successful execution. I want to be able to stop execution at any time and display a meaningful error message.
It would be very useful to be able to display a message like "Authentication failed" or similar if an OPEN sftp command fails and also for every single WINSCP scripting command.

Best regards,
M.R. - Toronto