I found there's a LANG environment variable with value zh_CN in environments (reported by set), but this variable does NOT exists in system-wide/current-user environments.

  1. After reboot, the LANG environment variable does not exists yet.
  2. After some operations, LANG will appear, and it affected environments of explorer.exe process (use procexp.exe to see environments of explorer.exe), hence, all new created child process will inherit environments of explorer.exe.
  3. After edit any environment variables and save, LANG will disappear.
  4. Repeat step 2, LANG does not appear anymore.

I can't figure out which operation in step 2 caused LANG appeared, but most likely, it's when right click a file and then menu popuped.

So, I suspect it's some shell extension programs add LANG environtment variable to explorer.exe. In the popup menu, there are the following shell extensions:

  • 7-Zip 9.22 beta
  • WinRAR 4.00
  • gVim 7.3.46
  • EditPlus v3.30 (v605)
  • Notepad++ 5.9 (UNICODE)
  • Git 1.7.4-preview20110204
  • TortoiseCVS 1.12.2
  • TortoiseSVN 1.16.16
  • XnView Shell Extension 3.0.0 (XnView 1.98)

Most of these programs related to LANG environtment variable (GUI language), but which one? Is there a tool to monitor environment variable?


Brute-force method:

  1. Open a Command Prompt, run set LANG= to remove the variable.
  2. Download ShExView and disable all extensions except one.
  3. Close Explorer and restart from the previously opened Command Prompt.
  4. Right-click a file, check if environment variable appeared.
  5. If %LANG% appeared, finish. Otherwise, enable another extension and go to #3.

You can close Explorer by killing it through Process Explorer, but here's a "clean exit" method:

  • Vista/7: Start, hold Ctrl+Alt+Shift, right-click on empty space, choose Close Explorer

  • XP: StartTurn Off, hold Ctrl+Alt+Shift, click Cancel

  • older versions: StartShut Down, hold Ctrl+Alt+Shift, click Cancel

  • Thanks for the great ShExView tool, and the "clean exit" method, never known these before. And finally, it's Vim Shell Extension added the LANG environment variable. Cheers! I'll uninstall gVim and reinstall without it's shell extension, or just disable Vim Shell Extension by ShExView. – LiuYan 刘研 Jun 15 '11 at 15:25
  • 1
    the related Vim Shell Extension code is here: code.google.com/p/vim/source/browse/src/GvimExt/gvimext.cpp#286 – LiuYan 刘研 Jun 15 '11 at 16:23
  • @LiuYan: Or you could instead permanently set the variable to whichever value you think is correct, if zh_CN is not. – grawity Jun 15 '11 at 19:43
  • LANG environment variable is unexpected/unwanted. It affects Cygwin and others' environment. – LiuYan 刘研 Jun 16 '11 at 3:28
  • It was Vim Shell Extension for me too. – Thomas Levesque May 23 '18 at 9:08

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.