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: Multiple commands on one line in a batch file

The command line (for any application) is actually one-line only always.

Only in Windows batch files you can visually break that one line into multiple lines by delimiting the "new line" with the ^.

The ^ is not WinSCP syntax, it's a batch file syntax. WinSCP never sees the ^.

So your batch file actually executes this command-line:
"C:\Program Files (x86)\WinSCP\WinSCP.com" /command "open ftp://anonymous:anonymous%%40example.com@10.203.63.14/"    "cd /\STRATEGY\" "lcd ""C:\Users\Mark Dullingham\Documents\Backup Test""" "get L030N014.IQ3" "exit"

And that answers your question.
Mark_D

Multiple commands on one line in a batch file

Hi all

I want to make it easier for some of mu colleagues to write a site specific batch file to retrieve some files. We have the ability to export some details in to excel and I can ther3efore get excel to insert the relevant info in to a long text string.

For this to work I need ALL of the commands in the following code to be on one line.
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /command ^
    "open ftp://anonymous:anonymous%%40example.com@10.203.63.14/" ^
    "cd /\STRATEGY\" ^
    "lcd ""C:\Users\Mark Dullingham\Documents\Backup Test""" ^
    "get L030N014.IQ3" ^
    "exit"

I think it has something to do with the ^ symbol but I'm not sure how to remove this or does it need to be replaced by another symbol.

Any help much appreciated.