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.
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] |
Thank you for the clarification. I learnt a new thing today. So it is impossible to manipulate Perl NOT to start a copy of cmd.exe right? I mean perl always starts a copy of cmd.exe which I don't know is preferred or not. But I know now it is not possible to do this. :)
| [reply] |
Perl cannot run batch commands; only cmd.exe can run them -- ie. cmd.exe is the interpreter for batch commands, just as perl is the interpreter for Perl code -- so no; if you want run a batch file, it has to be done by cmd.exe.
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] |