Error handling in a batch file
Firstly, thanks for any help offered in advance. I do not use batch files a great deal and therefore my knowledge is limited.
I have created a batch file to connect to a number of ftp servers and copy a directory which works fine if the server is online. Occasionally the server may be offline and as such the batch file stops at that point and closes.
What I would like to happen is if an error occurs with one line it moves to the next.
In my code below I have each connection command and get commands in one line for each server.
If one line causes any errors I want to move to the next until all lines are complete. The actual batch file has about 50 such lines.
I have googled error handling in batch files but do not know enough to decide if the error handling is a command line event or a WinSCP event hance me posting here first.
Any help much appreciated.
I have created a batch file to connect to a number of ftp servers and copy a directory which works fine if the server is online. Occasionally the server may be offline and as such the batch file stops at that point and closes.
What I would like to happen is if an error occurs with one line it moves to the next.
In my code below I have each connection command and get commands in one line for each server.
If one line causes any errors I want to move to the next until all lines are complete. The actual batch file has about 50 such lines.
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^ /log="C:\Users\??????????\Documents\Backup Test\WinSCP.log" /ini=nul ^ /command ^ "lcd ""C:\Users\??????????\Documents\Backup Test""" ^ "open ftp://tridium:??????????@10.203.61.100/" "cd /ffs0/niagara/stations" "get "KPMG_15CSQ_L13_DVD_N"" ^ "open ftp://tridium:??????????@10.203.61.103/" "cd /ffs0/niagara/stations" "get "L13_15CSQ_S"" ^ "exit"
I have googled error handling in batch files but do not know enough to decide if the error handling is a command line event or a WinSCP event hance me posting here first.
Any help much appreciated.