Topic "Scripts can use env variables"

Author Message
LeeMeador

Guest


I suggest documenting better the fact that we can now (as of some version between 3.8 and 4.1.Cool use %envvar% inside WinSCP scripts. All I found was it used in some example scripts. The main "script" page should have added somthing like:

You can use environment variables inside scripts similar to the way you can inside Windows batch files. Use the form %var1% in the script file and it will be replaced when the script is running by the current value of the environment variable "var1". You can set environment variables from the Windows command line with the command "set var1=\files\file1.txt" or they can be set from the system control panel. Click "Advanced" tab then the "Environment Variables" button and you can add and modify values. Note that the values you set under the control panel editor become active when you open a new DOS box but the "set" command causes instantaneous changes.

Or something like that. Maybe an example with a batch file and a script would make it clearer.

-- Lee
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26330
Location: Prague, Czechia
This is documented on a beginning of scripts commands section.
_________________
Martin Prikryl
vincentl

Guest


Hi,

I would like to know whether is there any script that has already shared that could download specific file based on the filename which has the timestamp of current date.

example:
Today's system date is 2017-01-19 (yyyy-mm-dd) the filename would be SI_2017-01-19_ABC_0981_ALL.csv

The FTP site folder has all daily files and I would only need to download a specific file of the day. Everyday the filename would change based on the system date where the prefix is not change.

Filename: SI_YYYY-MM-DD_ABC_0981_ALL.csv , the YYYY-MM-DD would be based on today's system date.

Winscp Version 5.5.6 (build 4746)

Thank you very much.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26330
Location: Prague, Czechia
See https://winscp.net/eng/docs/script_download_timestamped_filename
Advertisements

You can post new topics in this forum






Search Site

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!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License