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 current directory 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 current directory 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 parent folder 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