Topic "Capability"

Author Message


I was looking through the documentation and not sure I can accomplish what I need. I would like to ask a simple question if possible. I'm no expert on FTP or scripting, but not afraid to do the work to make it work. Before I go down that route can someone confirm that I can accomplish the following.........

I want to put a command line at the top of a batch job that confirms that the receiving FTP server is online and functioning. I'm thinking I would write a login script and if it does not work WinSCP would return some type of error code which the batch job can look for. If the error exists the batch job would exit and not try to send the data file.

Can this be done using WinSCP?

Thank you
[View user's profile]
Joined: 2012-05-29
Posts: 76
Location: Oslo

'' is the thing to use for scripting, read the docs here:

Open a connection and exit:
Code: /command "open" "exit"

Then check return code of last command:
echo %errorlevel%

So if it doesn't work or server is down:

Code: /command "open" "exit"
Connecting to ...
Connection failed.
No connection could be made because the target machine actively refused it.
Connection failed.

echo %errorlevel%

Thank you. I'll look through the documentation and do some testing. I appreciate the help very much.

I downloaded the program and tested it with your command and it worked perfectly! Thank you so much! I'll make a PayPal donation to the cause.
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26456
Location: Prague, Czechia
Sure. Start here:

You can post new topics in this forum


What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License