Passing String Variable to Winscp lcd command

Advertisement

ds222018
Joined:
Posts:
2
Location:
Germany

Passing String Variable to Winscp lcd command

Hello,

I have a problem passing a string variable to the lcd parameter in winscp commandline.

What I am doing and that works:
------------------------------------------
-using a .vbs Script with the needed code. I will give the users only the compiled .exe of the script so the credentials remain hidden for "normal users"
-I start the Script in the folder with the files I want to upload
-then the Script changes the CurrentDirectory to the parentfolder where the Winscp-Executables (.com / .exe) are stored.
-then I call winscp with the commandline "open sftp..." "cd on remote machine" "lcd D:\" "put filetobeuploaded.pdf" "close" "exit"
-all of the above mentioned works fine

The problem is:
------------------------------------
-I want to pass to the lcd parameter a string variable with another directory
-so CurrentDirectoy remains the same, but the file to be uploaded is stored in the child folder, where the user has executed the .vbs script first
-something like: "lcd & my_String_with_Path"

Why do I want this:
------------------------------------
-an unskilled user has to upload special files from time to time to a website, not knowing the credentials for the server
-i provide for each pdf-document one windows folder with the document and the regarding .vbs script to upload it compiled in an .exe file
-in the parentfolder i want to store the winscp.exe / winscp.com files, so I needn't have to store it in each folder

Can you please tell me if it is possible to pass a string variable containing a path to the lcd parameter. If so, could you please post an example with the correct syntax? Do I have to use "&" like in VBA to concatenate strings or do I have to use how many double-quotes?

Until now I have invested several hours looking for an solution, but I still missing the right script. I know that I can pass parameters from a batch file, but this won't help me.

Thanks in advance, would be great to get this problem solved!

Kind regards,

Dirk from Germany

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum