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

Advertisement

RJ101
Guest

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.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
37,591
Location:
Prague, Czechia

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%.

Reply with quote

RJ101
Guest

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.

Reply with quote

Advertisement

You can post new topics in this forum