When I run cmd.exe and type 'set' I have a %LIB% variable set. The value is pointing to a folder that doesn't exist, which causes warnings during Visual Studio compiles.

Here's the thing... If I go to System Properties->Advanced->Environment Variables it's not set in either User Variables or System Variables. It's also not set in my C:\Autoexec.bat.


Microsoft's Command Shell Overview gives a detailed description of where/how variables are stored.

The punchline is that User vars are stored in HKCU\Environment, and System vars are in HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment.

  • Thank you, but I've already read that document and looked in those registry keys. They contain the same values that "System Properties->Advanced->Environment Variables" contain. Which is to say, they don't contain my %LIB% var. Where else might it be set?
    – Swoogan
    Nov 1 '10 at 18:03
  • OK, do you have a login script, which that document also lists? How about autoexec.bat and any other startup scripts?
    – mfinni
    Nov 1 '10 at 18:14
  • I can't find where it's set (other than "it's set by an old version of Visual Studio"), but you can use the set command to change the EnvVar to another path.
    – gWaldo
    Nov 1 '10 at 18:17

Not sure where it was set from, but I was able to get rid of it by setting it in System Properties->Advanced->Environment Variables to "c:\". I then could select it from the list and click delete. Afterward it was gone from my command prompt.


If you run VS command prompt, you should be able to see LIB env there, I suppose. So the way you set this variable is primarily via visual studio. Go to Tools and click Options to get the window. There, find 'project and solutions' and click VC++ Directories if you work with C++. Then on the right hand side, you should see the menu 'Show directories for:' and when you click that button, you will see Library files. That is one of the places where you can specify your library path. HTH.

  • This really has nothing to do with VS, the VS command prompt, and definitely not C++. When I run cmd.exe it's there. Where can I "unset" it?
    – Swoogan
    Nov 1 '10 at 17:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.