Posted: 2005-02-08 19:28
How can we use variables ie. $1, $2 etc within a script and then pass them at invocation.
For example I create a script which need to Put 3 files to the Open SSH server. I would like to invoke a common script with a stored session and pass the filenames in the command line.
winscp3 email@example.com /script=ex.txt file1 file2 file3
Within the script I would use
where $1 = file1 etc.
Any ideas anybody?
Location: Prague, Czechia
It is not bad idea, however WinSCP currently does not allow it.
But you can easily implement this using .bat file:
rem Do we have some parameters at all?
if "x%1" == "x" goto syntax
rem Delete the old script, if exists
if exist script.txt del script.txt
rem Append "put" command for the file
echo put %1 >> script.txt
rem Delete the first parameter and shift remaning by one to left
rem Are we at the end of parameter list already?
if not "x%1" == "x" goto next
winscp3 firstname.lastname@example.org /script=script.txt
echo upload.bat file1 [file2 ...]
You can post new topics in this forum
And it's free!