Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Passing local parameter to remote session

First, typically you want to execute a winscp.com from a batch file, instead of winscp.exe.
See https://winscp.net/eng/docs/executables

blumko wrote:

WinSCP.exe /console /parameter timestamp /command "open sftp://exchange:ut9k3cm0@10.213.114.3:22" "mkdir %1%"

You need to use %timestamp% syntax to make Windows expand the variable name.

Though there's no point passing a value of an environment variable as parameter when you can resolve it directly in the command:
WinSCP.com /command "open sftp://exchange:ut9k3cm0@10.213.114.3:22" "mkdir %timestamp%"
blumko

Passing local parameter to remote session

Dear friend,

Please help me with such a problem: I want to pass a variable stored current date to my remote session and create there new folder with the name of that variable (e.g. 20140611). I tried some combination, mostly got an error "Missing parameter for the command mkdir". The last version of my batch script is:
@ECHO OFF
cls
date <nul >~datetime.txt
for /f "eol=E tokens=5-9 delims=/ " %%i in (~datetime.txt) do (
set month=%%j
set day=%%k
set year=%%l
)
set timestamp=%year%%month%%day%

WinSCP.exe /console /parameter timestamp /command "open sftp://exchange:ut9k3cm0@10.213.114.3:22" "mkdir %1%"

Please, what have I wrong? Thank you in advance for help.