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: Can I use a variable to repeat a get -filemask destination path

You can set an environment variable in the parent batch file:
set DESTINATION=\\192.168.1.10\fixeddestination\

and use it in WinSCP script like:
get fileA*.txt>today %DESTINATION%

See https://winscp.net/eng/docs/scripting#variables
(Note that in your script the empty -filemask is redundant)

Another option is:
Upload to multiple servers / Parametrized script

Or you can just change the remote working directory:
cd \\192.168.1.10\fixeddestination\
get fileA*.txt>today
get fileB*.txt>today
get fileC*.txt>today


Or specify the multiple sources in one command:
get fileA*.txt>today fileB*.txt>today fileC*.txt>today \\192.168.1.10\fixeddestination\


Or even simplify the mask using set pattern to:
get file[ABC]*.txt>today \\192.168.1.10\fixeddestination\

https://winscp.net/eng/docs/file_mask#basic
rustlerush

Can I use a variable to repeat a get -filemask destination path

I have
get -filemask fileA*.txt>today \\192.168.1.10\fixeddestination\
get -filemask fileB*.txt>today \\192.168.1.10\fixeddestination\
get -filemask fileC*.txt>today \\192.168.1.10\fixeddestination\

Does a way exist to declare the path \\192.168.1.10\fixeddestination\ just once as in:-
var destination = \\192.168.1.10\fixeddestination\

enabling me to write
get -filemask fileA*.txt>today destination\