1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

OT: Rex, how does CMD handle its environment?

Discussion in 'Support' started by vefatica, Aug 12, 2012.

  1. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,971
    Likes Received:
    30
    Rex, you probably know more about how CMD works than most persons. I wrote this (below) in another thread. Please comment.

    CMD must handle it's environment in a very peculiar way ... perhaps keeping a copy of it and **not** looking at the real environment when you query a variable with "SET varname". I'll start with this in in CMD:

    Code:
    C:\Users\vefatica> set q
    q=666
     
    C:\Users\vefatica> echo %q%
    666
    Now I'll use DynamicSetEnvVar (or my PSET) to set CMD's q to 999. Back in CMD I see:

    Code:
    C:\Users\vefatica> set q
    q=666
     
    C:\Users\vefatica> echo %q%
    999
     
    C:\Users\vefatica> set q
    q=666
    At this point, I can force CMD to update its copy (?) of the environment by (in CMD) setting some other variable!

    Code:
    C:\Users\vefatica> set x=0
     
    C:\Users\vefatica> set q
    q=999
     
    C:\Users\vefatica> echo %q%
    999
     

Share This Page