Topic "Passing local parameter to remote session"

Author Message
[View user's profile]

Joined: 2014-06-11
Posts: 1
Location: Slovakia
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:
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@" "mkdir %1%"

Please, what have I wrong? Thank you in advance for help.
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26890
Location: Prague, Czechia
First, typically you want to execute a from a batch file, instead of winscp.exe.

blumko wrote:
WinSCP.exe /console /parameter timestamp /command "open sftp://exchange:ut9k3cm0@" "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:
Code: /command "open sftp://exchange:ut9k3cm0@" "mkdir %timestamp%"

You can post new topics in this forum


What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License