Page 1 of 1 1
Topic Options
#125591 - 2004-08-25 09:35 AM How to get the value of an environment variable ?
Link Offline
Fresh Scripter

Registered: 2004-08-25
Posts: 6
Hello,
i need to get the "CLIENTNAME" value for user connected to terminal server.
How can i get and environment variable value ?

Thanks a lot for your help

Top
#125592 - 2004-08-25 09:47 AM Re: How to get the value of an environment variable ?
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
You simply use it directly in the code.

Code:
"Clientname = " + %CLIENTNAME% + @CRLF



You may also use ExpandEnvironmentVars(), where the environment variable is present in a string, such as an EXPAND_SZ read from the registry.

Top
#125593 - 2004-08-25 09:50 AM Re: How to get the value of an environment variable ?
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
what does this return ?

Code:
break on

"ClientName = " + %Clientname% ? ?
"Hit the keyboard to quit..."

get $

exit 1

_________________________



Top
#125594 - 2004-08-25 01:54 PM Re: How to get the value of an environment variable ?
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Maybe this needs to be an added macro?

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#125595 - 2004-08-25 02:36 PM Re: How to get the value of an environment variable ?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Maybe not.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#125596 - 2004-08-25 02:39 PM Re: How to get the value of an environment variable ?
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
It is an idea for TSE. Probably not a big deal. However, it does seem to be popular request to get this var.

Thanks!

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#125597 - 2004-08-25 02:46 PM Re: How to get the value of an environment variable ?
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
It is always populated in the TSE environment, and directly usable in the code.

Why would you want the overhead of a redundant macro?

What do you think is more useful about a macro that having the value presented that way is superior to having it in an environment variable?

Do you forsee a problem with the environment variable being unavailable or spoofed?

Top
#125598 - 2004-08-25 02:48 PM Re: How to get the value of an environment variable ?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Once one learns the intricacies of using environment vars and the ExpandEnvironmentVars() function, there is no need for the macro.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Henriques) and 2516 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.067 seconds in which 0.035 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org