Password Batch

Advertisement

Michale
Joined:
Posts:
1

Password Batch

Hello
I cant connect to a sftp through a bat file
apparently the password does not get recognized because it has some special characters

original password: +9lz3-MN
encoded password: %2B9lz3-MN

Batch File contains the following:
"C:\Program Files (x86)\WinSCP\WinSCP.com" /log="C:\WinSCP.log" /ini=nul /command "option batch continue" "option confirm off" "open sftp://<username>:%2B9lz3-MN/ -hostkey=""ssh-rsa 2048 xxx""" "option transfer binary" "synchronize local C:\ /Info/" "exit"

I'm getting the following log errors:

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
33,516
Location:
Prague, Czechia

Re: Password Batch

It's only guess, as the log file is not complete: In Windows batch file the % sign has a special meaning. Particularly the %2 is replaced with the second argument of the batch file. So the %2 never makes it to WinSCP. You need to escape the % by doubling it to %%2B9lz3-MN.

See https://winscp.net/eng/docs/faq_batch_file#percent

Reply with quote

Advertisement

You can post new topics in this forum