in reply to Re^2: Avoid headaches from Strawberry Perl 5.10.0 and binary SVK
in thread Avoid headaches from Strawberry Perl 5.10.0 and binary SVK

This has nothing to do with the global environment variables. They are not being modified in any way here.

Because .BAT files are interpreted by the shell (cmd.exe) itself, set commands modify it's own copy of the environment vars and as it persists after the .BAt file ends, so do the changes made to it. Within that command shell instance only.

No other existing instances are affected. And no new instances will be affected, unless they are started as children of this instance, in which case they will inherit the modifications made to their parent. When this instance (and any children it started) ends, the modifications disappear.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."
  • Comment on Re^3: Avoid headaches from Strawberry Perl 5.10.0 and binary SVK

Replies are listed 'Best First'.
Re^4: Avoid headaches from Strawberry Perl 5.10.0 and binary SVK
by dragonchild (Archbishop) on Jan 09, 2008 at 17:47 UTC
    Changes made by a command in Unix cannot affect the shell the command was invoked from. This is because all commands are run in child processes. Apparently, Windows runs things in child threads?

    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
      Apparently, Windows runs things in child threads?

      No. No threads involved either. When unix runs a shell script, it forks the existing shell and runs the script in the child process. And environment changes are made to the child's environment block and so disappear when that shell exits. Whilst it runs, the original shell sits in the background and waits. And it is to that parent shell instance that you are returned, when the script ends.

      In Windows, the .bat file is run within the same instance into which the command is entered and it is to that same instance that you are returned when the bat file ends. So any changes the .bat file makes to that shell instances environment are persisted.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
        Ah. Wow. Maybe I'm just brainwashed, but letting program changes persist just seems like a recipe for disaster. *shrugs*

        My criteria for good software:
        1. Does it work?
        2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?