in reply to Re: Passing value from IF loop
in thread Passing value from IF loop

I agree with Utilitarian's comments about the current environment. To illustrate his point, you can do the following test:

  1. Open two command prompts.
  2. In the first command prompt, add/modify an environment variable.
  3. In the second command prompt, check on that environment variable. It won't see any changed values or any new variables.
  4. Open a third command prompt and check on the environment variable added/modified in step 2. This time, the addition/change should be detected.

Personally, I am unaware of how to 'reset' the environment for command prompt or script, but that's not to say it can't be done. Short of doing that, I think Utilitarian's suggestion of writing to a file would be a good idea.