in reply to Re^4: Windows environment variable not set if calling from a perl program (goto :end)
in thread Windows environment variable not set if calling from a perl program
If I invoke the batch file from inside another batch file - I can do this.
Yes. Because running a batch file from another batch file does not start a new process. cmd.exe is the batch processor, so the changes are made to the current process' environment; and when you exit the called batch file, you are still running under the auspices of that same process. Hence, you can see the changes.
But, when you call a batch file from perl, perl has to start a copy of cmd.exe to execute it; so the changes are made to cmd.exe's copy of the environment, but as soon you return to perl, that process and its environment is thrown away and you return to the same environment you had before you started that child process.
What you are trying to do is impossible.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Windows environment variable not set if calling from a perl program (goto :end)
by svasa (Initiate) on Dec 08, 2015 at 19:14 UTC | |
by BrowserUk (Patriarch) on Dec 08, 2015 at 19:20 UTC |