Mail Archives: djgpp/2004/02/02/14:51:42
> From: "Robbie Hatley" <loneXwolfintj AT pacXbell DOT net DOT remove DOT Xs>
> Newsgroups: comp.os.msdos.djgpp
> Date: Mon, 2 Feb 2004 05:16:34 -0800
> >
> > The only portable way to do it is with a batch file.
>
> Hmmm... how about a non-portable way? Even that might be
> useful.
A non-portable way involves chasing the DOS memory chain and modifying
it when appropriate. I don't recommend that, what with the multitude
of possible shell versions out there. Specifically , NTVDM might
block this entirely (I didn't try, so I don't know).
> Batch files only seem to work for setting environmental variables if not
> invoked from within a program. Otherwise, you end up with the same
> thing: variables gone after program exits:
>
> (program runs...)
> int main(void)
> {
> system("MyFancyBatchFile.bat"); // set TEST=ASDF
> return 0;
> }
> (...program exits)
>
> Then type "set" at DOS prompt, and oops, the variable TEST
> does not exist. :-(
>
> Surely there's got to be a way around that dilemma.
Perhaps; but it's hard to tell without knowing what problem, exactly,
are you trying to solve.
- Raw text -