Ardy Nugraha
Ardy Nugraha

Reputation: 23

WinSCP script file with username and password

How to run WinSCP script file that needs username and password.

I want to run this using batch file:

cd C:\Program Files\WinSCP

WinSCP.com

open ftp://ipaddress:port -passive=on

....after that, I need to input my username

...and after that I need to input my password

Here is my batch file, but it always fails:

cd C:\Program Files\WinSCP
WinSCP.com /command "option batch on" "option confirm off" "open ftp://ipaddress:port -passive=on"""
"-username myusername"
"-password mypassword"
"cd PO"
"cd D:\"
"mget *.*"

Thank for your help...

Upvotes: 2

Views: 10055

Answers (2)

Martin Prikryl
Martin Prikryl

Reputation: 202168

Use

open ftp://user:password@ipaddress:port

References:


Also note that WinSCP has the put command for recursive uploads. The mput is just an alias to the put, supported for compatibility reasons.


You probably wanted to do lcd D:\, instead of cd D:\.

Upvotes: 2

Serenity
Serenity

Reputation: 46

According to the help file you are making up your own parameters which is why they don't work.

Use traditional means of specifing your password as Help shows. NOTE: These techniques are REMOVED from Windows for security reasons.

ftp://username:[email protected]

According to Help you can also pipe standard in with parameters.

http://winscp.net/eng/docs/commandline

Upvotes: 0

Related Questions