Passing a file name in the command line to a script

Advertisement

ldaugher
Guest

Passing a file name in the command line to a script

I have a .bat file that is calling winscp with a /script. The script needs to upload a file through SFTP. I would like to be able to pass the file name that is to be uploaded via the command line. I see in the FAQ (https://winscp.net/eng/docs/scripting#quotes) where this is addressed if the file name has spaces in it; however, my files do not have spaces in it so I was hoping that the steps addressed on this page were not necessary and there was an easier way to accomplish this. If it can be passed as a command line parameter, can you say what the parameter would be as well as how to pick up that parameter value within the script itself (is it %1?)

Thanks so much
Laura

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,567
Location:
Prague, Czechia

Re: Passing a file name in the command line to a script

Parameters cannot be passed into script. But you can setup complete script on command line using /command parameter.

Reply with quote

Advertisement

You can post new topics in this forum