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 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

Reply with quote

Advertisement

ds222018

Re: Passing String Variable to Winscp lcd command

Thank you so much!!! Works fine with D:\, tomorrow I´ll try a little bit more but it looks very good! You have helped me a lot! Greetings to Prague!

Reply with quote

Nitin Pandey
Guest

Question regarding WinSPC

I have created the varchar data type for string in my Oracle database. Then do I need to make TAGS for this varchar data value in WinSPC part/process or do I need to make variable in WinSPC part/process.

Reply with quote

martin
Site Admin
martin avatar

Re: Question regarding WinSPC

@Nitin: I'm sorry, but I do not understand what you ask for. Please give us more details. Also Is WinSPC a typo? Or are you really asking about WinSPC, what is different software than WinSCP (what this forum is about)?

Reply with quote

Advertisement

You can post new topics in this forum