Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

ceokep

Managing special characters in batch script to write winscp open connection string

I'm trying to write the batch code to generate a script into a file, to open a connection with winscp; the final command should be like: open sftp://user:password@example.com/ (without quotes).
The password contain the char + and I must change it into %2B to make winscp undersand.

set pw=mypassword+
::echo %pw% return--> mypassword+
set st=%%2B
::echo %st% return--> &2B
call set pw=%%pw:+=%st%%%
::echo %pw% return--> mypassword2B


I can't find the way to make last call to return %pw%=mypassword%2B (with % before 2B) to pass to winscp script. Can you help me, please? There another strategy (but always in batch dos) to make open winscp command to accept the correct password? Thanks in advance. CeoKep