WinSCP cannot accept special characters (@ or %) in password

Advertisement

Farhana
Guest

WinSCP cannot accept special characters (@ or %) in password

Hi,

I am using WINSCP3. In the script, if I use any special characters(.i.e @), it fails to upload. I am using hexadecimal ASCII code for special character, but still is not working

for an example:

pwd: abcd@123

and I changed to abcd%40123 in the script.

Could someone please tell me what's the correct procedure to use special characters in password in the script?

Many Thanks,
Farhana

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,441
Location:
Prague, Czechia

Re: WinSCP cannot accept special characters (@ or %) in password

It works for me. What version of WinSCP are you using? Make sure you use the latest version.

Reply with quote

Guest

Re: WinSCP cannot accept special characters (@ or %) in password

martin wrote:

It works for me. What version of WinSCP are you using? Make sure you use the latest version.

Thanks for the quick reply! I am using 4.2.5. It does not take "%" or "/" as password. Could you please tell me which version are you using?

Reply with quote

martin
Site Admin
martin avatar

Re: WinSCP cannot accept special characters (@ or %) in password

The same. Can you a post a full example of the script command. Also where do you run the command from? Script or command-line (with /command parameter)?

Reply with quote

Guest

Re: WinSCP cannot accept special characters (@ or %) in password

I am using Java to create the stript to synchronize local folder.
The java program takes the password as an input. I have created jar file for the program.

The following is the sample code:
ftpUrl = ftpLoginName + ":" + ftpLoginPass + "@" + ftpDomainUrl;
// Create file
fstream = new FileWriter("SiteExportImport3.cmd");
out = new BufferedWriter(fstream);
out.write("@echo off\r\n" +
"echo option batch on>SFTP_Script.txt\r\n" +
"echo option confirm off>>SFTP_Script.txt\r\n" +
"echo open " + ftpUrl + ">>SFTP_Script.txt\r\n" +
"echo option transfer binary>>SFTP_Script.txt\r\n" +
"echo synchronizelocal "+localDirectoryName+">>SFTP_Script.txt\r\n" +
"echo close >>SFTP_Script.txt\r\n" +
"echo exit>>SFTP_Script.txt\r\n" +
"call \"C:\\Program Files\\WinSCP\\WinSCP.com\" / hostkey=\"XXX\"/script=\"SFTP_Script.txt\">log.txt\r\n" );
out.close();

in the command prompt I execute the jar file with the parameter:
MYFTP.jar password

It works fine when I don't use "%" or "/" in my password

Thanks,
Farhana

Reply with quote

Advertisement

martin
Site Admin
martin avatar

Re: WinSCP cannot accept special characters (@ or %) in password

Possibly the echo shell command interpret the % its own way. Why don't you generate the SFTP_Script.txt directly from JScript?

Reply with quote

Guest

Re: WinSCP cannot accept special characters (@ or %) in password

You are right about echo command! It does interpret the % in different way! Thanks a lot for your help! :)

Reply with quote

Advertisement

You can post new topics in this forum