www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/07/19/10:41:13

From: "west.usenetserver.com" <glenm AT myself DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Updating the program caller's environment from the called program
Lines: 27
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Message-ID: <Jrgd5.4951$mL5.200531@news-west.usenetserver.com>
X-Abuse-Info: Please be sure to forward a copy of ALL headers
X-Abuse-Info: Otherwise we will be unable to process your complaint properly
X-Complaints-To: support AT usenetserver DOT com
NNTP-Posting-Date: Wed, 19 Jul 2000 07:39:21 EDT
Organization: WebUseNet Corp http://www.usenetserver.com - Home of the fastest NNTP servers on the Net.
Date: Wed, 19 Jul 2000 13:39:16 +0200
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I have written a program that allows adds path(s) and or file(s) to the
environment.  The command line is like this


AddToEnv envName pathToAdd

so for example a call like 'AddToEnv PATH C:\DOS\' would add the C:\DOS\
directory to the PATH environment variable if it wasn't already there.

So the problem is currently I have not figured out how to update the
caller's environment.  So when the AddToEnv.exe changes the environment the
program ends and the previous environment is restored.  Is there a way (and
if so how? example code or source code that does just that would be great)
to update the caller's environment.  I would like to code a solution that
works under plain DOS, and Win32 DOS Boxes.

I currently get around this with a source code solution.  Having AddToEnv
output a batch file and wrapping the process in a bat like this

AddToEnv envName pathToAdd > %temp%\temp.bat
call temp.bat

where AddToEnv outputs a set xxxx=jkfhasdljkfh string to temp.bat.

any coding help is appreciated




- Raw text -


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