Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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

RJ101

Re: DOS Bat file parameter value passed to WinSCP script does not work within the PUT command to specify

Thanks Martin, of course it would be %5%, I can't believe I didn't spot that. Thanks for replying and saving me a lot of hassle and time.
martin

Re: DOS Bat file parameter value passed to WinSCP script does not work within the PUT command to specify

What you are passing as %6 is 5th parameter of WinSCP. So you need to refer to it by %5%.
RJ101

DOS Bat file parameter value passed to WinSCP script does not work within the PUT command to specify

WinSCP version: 5.21.1

Hi,
Is it possible to pass a parameter to a Bat file and then from the Bat file to a WinSCP DOS Script to specify the destination file name within the put command?

For example -
My Bat file contains the following command -
Winscp.com /ini=nul /script=Mycripts\FTPS-to-site.txt /XMLlog=%5.xml /loglevel=1 /parameter %1 %2 %3 %4 %6

I am calling the Bat file with 6 values being passed to it.

One of the lines in my WinSCP script "FTPS-to-Site.txt" is -
put -preservetime "%3%"\"%4%" %6%

Where %3% is the source path and %4% the file name. %6% should be the new file name value.
I have tried different variations like %6, "%6%", %%6% which all result in the destination file being named %6% or %6 etc... It seems WinSCP is taking any text entered after the "%4%" literally and not as a parameter.

Any suggestions please?
Thanks.