Page 1 of 1 1
Topic Options
#125387 - 2004-08-19 09:00 PM Environment variables
Jose Offline
Seasoned Scripter
*****

Registered: 2001-04-04
Posts: 693
Loc: Buenos Aires - Argentina
Hi Korgers !! how are you guys doing?

Is there a way to see "all" the environment variables available in an NT/2000/XP system?
I am looking forward to make more use of them.

Thanks!.
_________________________
Life is fine.

Top
#125388 - 2004-08-19 09:03 PM Re: Environment variables
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
what about fire up command prompt shell and type "set" in it?
in normal windows that's what you have.

with never windows, like windows 2003 you have some extra...
like:
%time%
_________________________
!

download KiXnet

Top
#125389 - 2004-08-19 09:10 PM Re: Environment variables
Jose Offline
Seasoned Scripter
*****

Registered: 2001-04-04
Posts: 693
Loc: Buenos Aires - Argentina
Thanks very much Jooel.
_________________________
Life is fine.

Top
#125390 - 2004-08-19 09:21 PM Re: Environment variables
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
no problem, green-man!
_________________________
!

download KiXnet

Top
#125391 - 2004-08-19 09:22 PM Re: Environment variables
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
You could never see ALL of the available variables since anyone can create whatever they want.

For example, if you typed:

SET JOSE=COOL
You would have one that probably nobody else has.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#125392 - 2004-08-19 09:41 PM Re: Environment variables
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
but then, set would reveal that too, no?
_________________________
!

download KiXnet

Top
#125393 - 2004-08-19 09:51 PM Re: Environment variables
Jose Offline
Seasoned Scripter
*****

Registered: 2001-04-04
Posts: 693
Loc: Buenos Aires - Argentina
Thanks for the tip Les. Very nice of you.
_________________________
Life is fine.

Top
#125394 - 2004-08-19 10:33 PM Re: Environment variables
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Quote:

but then, set would reveal that too, no?





He asked for ALL "NT/2000/XP system" so no, unless he ran around and SET all of them to be the same...

It is like asking for all the words in the dictionary... would depend on what dictionary in what language and what year. And them we need to talk about all the made up words too.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#125395 - 2004-08-19 10:38 PM Re: Environment variables
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
les, I'm glad you are my "friend"!
if you was my enemy, you would have good arguments for my disposal

to get un-serious, you are right, ofcourse.
his wording will be interpreted like that if taken from word to word.
_________________________
!

download KiXnet

Top
#125396 - 2004-08-20 09:57 AM Re: Environment variables
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
For the sake of completeness you should know that some environment variables are virtual, so won't appear in "set".

They also won't be available to KiXtart.

Some examples are %RANDOM%, %ERRORLEVEL%, %TIME% and %DATE%. These are only available when referenced within a DOS shell command interpreter, so you can use them in batch files and on the command line.

{edit}
Just noticed Jooel already mentioned %TIME% in his earlier post.
{/edit}


Edited by Richard H. (2004-08-20 10:00 AM)

Top
#125397 - 2004-08-20 10:18 AM Re: Environment variables
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
richard, do you know is there a reference about these?
and what windows consoles support that?

I got scared when played with my backup script and noticed server2003 supported these.
_________________________
!

download KiXnet

Top
#125398 - 2004-08-20 10:28 AM Re: Environment variables
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
I found them some time back using "set /?".

%ERRORLEVEL% was available in NT 4 (although it is not mentioned), the others appeared in Win2K.

If you set the environment variables yourself then they override the dynamic ones, so any scripts you have that use them will continue to work.

Top
#125399 - 2004-08-20 10:40 AM Re: Environment variables
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hmm...
think errorlevel has been there "always" and yes, the others indeed work in my w2k box
_________________________
!

download KiXnet

Top
#125400 - 2004-08-20 10:57 AM Re: Environment variables
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Quote:

hmm...
think errorlevel has been there "always" and yes, the others indeed work in my w2k box




No, the crap ERRORLEVEL has pretty much always been there (as in IF ERRORLEVEL...), but the environment variable %ERRORLEVEL% has not.

It won't work in a Win95 or NT 3.51 box, for example. If you can find one.

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
0 registered and 476 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.065 seconds in which 0.025 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