Windows environment variable path priority Test report

Source: Internet
Author: User

I always thought that I was already operating windows. Today I saw a large list of Unknown command line tools in its help, but this article has nothing to do with these tools, I typed an error while using a command. As a result, I couldn't help writing something.
When the running results of some commands are relatively long (several pages), I often output their results to a text. This is definitely a good habit, for example, for search:
If I want to find a file on disk D and do not know which folder it is placed in, I will use the Tree Command to write all the file names on disk D to the text and then query it from the text, the speed is faster than searching for a ddisk directly, and less system resources are used. If you don't believe it, try it.
Write all the file names and contents of the d drive to the C drive's 1.txt commandTree D:> C: 1.txt
This file can be saved and used later, if there is no major update.

Ah, it's far away.:)

I don't know what's going on today. It may be a small gap. The output of a command is written> CmdI immediately overwrite the command line file, did not care about the written CMD file, and habitually closed the command line window (I do not know why, knowing that I still need to input commands in this window, ), view the output, then learn how to use the next tool, run cmd, stay away, and output the result just now. Only then can I find out that the problem was caused by the loss of CMD just now. I thought about the location of the CMD file, it should be in the current user configuration folder (the default start position of CMD, this CMD is not another cmd). In, delete it. Suddenly it seems strange that the user does not set the PATH environment variable to configure the folder. How can this problem be solved ......
It should be the highest level path!

Then I thought it was fun to test the priority of the Environment Variable path one by one.

Test path4
% USERPROFILE %(Which is set by default by the system. The current user configuration folder is named after the current user in Documents and Settings. I am the Administrator currently)
% SystemRoot %(Windows in XP)
% SystemRoot %/system32
D: \ bat(User-defined path)
Create four files with no extension named "test" and put them in the above four folders. Set the content of each test file to the name of the folder where it is located.

Run test. The first output is (the content of the displayed test file)
Administrator
(Delete the test file from the folder)
Run test again.
System32
(Delete)
Run test again.
Windows
(Delete)
Finally
D: \ bat
(Delete)

OK. The result is displayed. The priority of the path is sorted from high to low:
% USERPROFILE %
% SystemRoot %/system32
% SystemRoot %
User-Defined path

It's useful for everyone to think about it, so I will not talk nonsense. The summary is complete!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.