in reply to
Re^2: Issue with env variables set through dos batch
in thread Issue with env variables set through dos batch
If you start a script, it gets the environment at the time. If that script fiddles with an environment variable, that is only a temporary setting for the duration that that script is running.
If you set an environment variable before a script is started, then the script inherits that value when it runs. Back up another level, when Windows boots, certain values are set in the environment and all processes inherit those values.