The new game method of environment variables in Windows operating system

  
Recently found that when friends play the computer, enter QQ.exe in "Run", QQ will run. This made me feel very surprised. I have tried to type QQ.exe in "Run" before, but it can't run. Why is this? Finally, at the friend's point, I finally got the answer. Let's share it with you.

I wonder if you noticed such a place: the system variable under "System Properties /Advanced /Environment Variables". We double-click the variable path under "System Variables". The system defaults only two variables, %SystemRoot%\\system32 and %SystemRoot%, which represent two directories, one is the system root directory, and the other is the system32 directory under the root directory. When we enter QQ.exe in the run, it will look in these two directories (the order of the search is based on the order in which the folders are written). If there is any, it will report an error.

Let's start to build our own "run", for example, QQ is installed under "E:\\QQ2", and our purpose is to directly enter "qq" in the operation to make it run. How to do it? Just add a statement "E:\\QQ2" to "path" (see Figure 1). Ok, now you can run the program directly by entering QQ in the run.

A friend may ask: When we enter CMD "run" instead of CMD.EXE, the system how to open CMD.EXE without opening CMD.COM or cmd.txt it? In fact, this is determined by "PATHEXT" under "System Variables". When we enter CMD in "Run", the system will search for one by one according to the order in which the extensions in "PATHEXT" are written (see Figure 2). If there is cmd.com, execute cmd.com instead of cmd. .exe or a file with a different extension called cmd. Knowing this rule, you can use it flexibly to get the best results.

Tip: a system but find the file will not go to other environmental variables in a directory, so we set the environment variable should also be careful.
Copyright © Windows knowledge All Rights Reserved