Topic "How to get ENV Variable?"

Author Message
Mahendran
[View user's profile]

Joined: 2008-03-31
Posts: 4
Location: Bangalore
I want to create a folder with the name specified in the ENV variable and perform "put" operation. How can I read a variable from ENV and include in the script. Please suggest. Thanks!
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
mkdir %ENV%
You need to have WinSCP 4.1 beta for that.
Mahendran
[View user's profile]

Joined: 2008-03-31
Posts: 4
Location: Bangalore
prikryl wrote:
mkdir %ENV%
You need to have WinSCP 4.1 beta for that.


I am using WinSCP 4.1 beta only. I have an environment variable "TEST" with the value Test. When I execute the command mkdir %TEST%, it actually creates %TEST% folder. Please suggest.

Below is the console capture.

winscp> option batch on
batch on
winscp> option confirm off
confirm off
winscp> open ftp://AM\Kumara:Password1@10.16.0.245:21
Connecting to 10.16.0.245 ...
Connected with 10.16.0.245. Waiting for welcome message...
Connected
Starting the session...
Reading remote directory...
Session started.
Active session: [1] AM\Kumara@10.16.0.245
winscp> cd /Project/Razor/Prelude/Builds
/Project/Razor/Prelude/Builds
winscp> mkdir %TEST%
Error creating folder '%TEST%'.
%TEST%: Cannot create a file when that file already exists.
(A)bort, (R)etry, (S)kip: Abort
winscp>
winscp>
Mahendran
[View user's profile]

Joined: 2008-03-31
Posts: 4
Location: Bangalore
Is it a problem with this version?
Is there any other way that I can use it now?

Thank You!

Mahendran wrote:
prikryl wrote:
mkdir %ENV%
You need to have WinSCP 4.1 beta for that.


I am using WinSCP 4.1 beta only. I have an environment variable "TEST" with the value Test. When I execute the command mkdir %TEST%, it actually creates %TEST% folder. Please suggest.

Below is the console capture.

winscp> option batch on
batch on
winscp> option confirm off
confirm off
winscp> open ftp://AM\Kumara:Password1@10.16.0.245:21
Connecting to 10.16.0.245 ...
Connected with 10.16.0.245. Waiting for welcome message...
Connected
Starting the session...
Reading remote directory...
Session started.
Active session: [1] AM\Kumara@10.16.0.245
winscp> cd /Project/Razor/Prelude/Builds
/Project/Razor/Prelude/Builds
winscp> mkdir %TEST%
Error creating folder '%TEST%'.
%TEST%: Cannot create a file when that file already exists.
(A)bort, (R)etry, (S)kip: Abort
winscp>
winscp>
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
How do you set the variable? Are you sure it is inherited properly into the environment you are running WinSCP from?
_________________
Martin Prikryl
Mahendran
[View user's profile]

Joined: 2008-03-31
Posts: 4
Location: Bangalore
I am sorry; I was wrong.

The window was opened before setting the variable and it wasn't able to get the name.

Now everything works fine.

Thanks for your help!
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