Mail Archives: djgpp/1997/06/25/21:04:22

From: e-mail DOT address AT end DOT of DOT text (Mike Collins)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: How to read/modify environment variables?
Date: 25 Jun 1997 09:39:48 GMT
Organization: Storage Technology Limited
Lines: 39
Message-ID: <5oqp14$>
References: <33B013CC DOT E452725B AT po DOT uni-stuttgart DOT de>
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <33B013CC DOT E452725B AT po DOT uni-stuttgart DOT de>, 
Martin DOT Bernreuther AT po DOT uni-stuttgart DOT de says...
>I like to write a small tool to add a path to the PATH variable
>only if it's not already in.
>How can I get a hold of the environment variables?
>Is there already a tool to do this?
>Is there maybe a tool just to search a environment variable for
>a string?
I know how to do it in a batch program, though it doesn't have much to do 
with DJGPP!


ECHO I just set the environment variable
REM do other stuff too if you want
goto END
ECHO The environment variable was already set.

It's cumbersome and there's probably a more elegant way, but you could try 
 using a 'system' statement (I have not tried this, and I don't even know 
if it works outside of a batch file)

system("if not %ABC%=XYZ set ABC=XYZ");

Don't just hit "reply" - my E-mail address is bogus
to avoid automatic browsers from sending junk mail.
Please use collim'at'anubis'dot'network'dot'com
Actually, even this doesn't stop all of them ...

- Raw text -

  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019