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: WINSCP script halt on no errors

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, use /log=path_to_log_file command-line argument. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.
Guest

WINSCP script halt on no errors

Hi all,

apologies if this has been covered a million times before (believe me I feel like I have read every post)

I have a script to download files via FTP to a local drive, it works up to the point where I get a permission error where it requires user input at which point it just stops. I have read you can over write this using the 'option batch continue' command however the script doesnt seem to recognise this as a command and I get 'option is not recognised as an internal or external command'

I have put the option command both before and after the WinSCP line in and out of quotes but get the same result.

below is my script:

@ECHO OFF
set TIMESTAMP_FORMAT=yyyy-mm-dd
cd "C:\Program Files (x86)\WinSCP"
for /F "tokens=* USEBACKQ" %%F in (`WinSCP.com /command "echo %%TIMESTAMP#%TIMESTAMP_FORMAT%%%" "exit"`) do set TIMESTAMP=%%F
set mydir=E:\folder\anotherfolder - Backups\%TIMESTAMP%
mkdir "%mydir%"
WinSCP.com /command ^
"option batch continue" ^
"open ftp://websiteftp:!password@somewebsite.co.uk" ^
"lcd ""%mydir%""" ^
"get *.*" ^
"exit"
pause

could anyone advise? I have seen example scripts where its not in quotes and just at the top of the script

Thanks