Topic "Multiple commands on one line in a batch file"

Author Message
Mark_D
[View user's profile]

Joined: 2016-10-27
Posts: 4
Location: London, England
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.

Code:
"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.
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 27059
Location: Prague, Czechia
The command line (fr 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.
Advertisements

You can post new topics in this forum

Search

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!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License