How to get ENV Variable?

Advertisement

Mahendran
Joined:
Posts:
4
Location:
Bangalore

How to get ENV Variable?

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!

Reply with quote

Advertisement

Mahendran
Joined:
Posts:
4
Location:
Bangalore

Re: How to get ENV Variable?

martin 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>

Reply with quote

Mahendran
Joined:
Posts:
4
Location:
Bangalore

Re: How to get ENV Variable?

Is it a problem with this version?
Is there any other way that I can use it now?

Thank You!

Mahendran wrote:

martin 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>

Reply with quote

martin
Site Admin
martin avatar

Re: How to get ENV Variable?

How do you set the variable? Are you sure it is inherited properly into the environment you are running WinSCP from?

Reply with quote

Advertisement

Mahendran
Joined:
Posts:
4
Location:
Bangalore

Re: How to get ENV Variable?

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!

Reply with quote

Advertisement

You can post new topics in this forum