Sunday, April 29, 2018

windows - Why doesn't CMD inherit environment variables on this machine?

For whatever reason, on a specific machine my cmd process doesn't inherit its environment variables from the parent process which launched it. Instead it reverts back to the "default" environment settings, like it was launched via explorer.


A simple way to demonstrate this is to open a command-prompt and then run set Path=C:\Windows\System32\, followed by launching another cmd process from the same prompt. The variable can then be viewed by running set Path.


It should be "C:\Windows\System32" (inherited from the launching process) but on my machine it's reverted back to my environment default.


You should see something like this:
Working command prompt


I instead get the following:
CMD breaking the rules


What could be causing this? It seems to break all the rules around how environment variables work and it only affects this one machine.

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...