Topic "Batch Script Parameters - Not working"

Author Message
sundar2013
[View user's profile]

Joined: 2016-04-04
Posts: 6
WinSCP - Version 5.12
Version of Windows - Windows 7
Transfer Protocol - SFTP
Error : Error changing directory to '%1%'.

In Arguments I am passing the below value -script="XXXXXX" -privatekey="XXX.ppk" -parameter="P:\Interface\Backup Files" -log="P:\Interface\winscp.log"

Batch Script :
option batch off
option confirm off
option transfer binary
open sftp:XXXXXXXXXXX -hostkey= XXXXXXXXXXXXXX
cd XXXXXXXX
lcd "%1%"
get *.txt
exit

Error : I am getting an error "Error changing directory to '%1%'". I believe that the batch file doesn't understand the parameter value. "%1%" not taking the value. IF I directly hardcode the path in text file, everything works fine, but I don't want to hard code the server name. Did I use the correct version of Winscp that support parameters?

Please help me.

Thanks.
Sundaramurthy J.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
There should be no = after the /parameter

The recommended syntax is:
/parameter // "P:\Interface\Backup Files"

See https://winscp.net/eng/docs/commandline#parameters
sundar2013
[View user's profile]

Joined: 2016-04-04
Posts: 6
Thank you Sir, Now the parameter is working perfectly.

Regards,
Sundaramurthy J.
Advertisements

You can post new topics in this forum






Search Site

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