Is their a way for a Child process to modify its Parent's environment?

WhatMeWorry via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 24 18:53:51 PDT 2014


I open a command line window, and run the following 6 line program

void main()
{
    string envPath = environment["PATH"];

    writeln("PATH is: ", envPath);

    envPath ~= r";F:\dmd2\windows\bin";

    environment["PATH"] = envPath;

    envPath = environment["PATH"];

    writeln("PATH is: ", envPath);

}

It prints out the following

PATH is: C:\Windows\system32;C:\Windows...
PATH is: C:\Windows\system32;C:\Windows...F:\dmd2\windows\bin

when the program exits, I'm back at the command line and I do a

echo %PATH%

which just shows C:\Windows\system32;C:\Windows...

Anybody know of a way to make the change stick for the lifetime 
of the
command window?


More information about the Digitalmars-d-learn mailing list