When we need to deal with files in different paths, it is very likely that we need to switch directories, at which point we can consider using the directory Jump command CD.
For example, when we open the Command line window, this is generally the case: in the bottom left corner of the desktop to find the "Start" menu, open "Run", enter "cmd", return. At this point, the default current directory for the command Line window is located under the current user's path, such as C:\Documents and SETTINGS\JM, as shown in the following figure.
Generally speaking, this directory does not have the files we want to process, we probably need to jump to other directories, such as: "C packing directory, this time, we need to use a CD to achieve the directory jump: cd C:\."
The full name of the CD is change directory, literal translation is changed folder, that is, jump directory, the meaning of the switch path. It can then be followed by the drive symbol, the full path, and the relative path. It is known from its full name that it cannot manipulate files and can only be used for drives or folders. For example, we use the CD C:\Boot.ini this command to jump (Boot.ini is a file instead of a folder), and a "directory name is invalid" error appears, as shown in the following figure.
If you want to jump to the root directory of the current directory, you can use a simple command: cd\. As shown in the following figure.
Continue to jump, cd c:\windows\temp, jump to temp directory.
At this point, if you want to go back to the previous level of directory windows, you can use this command: CD ... As shown in the following figure.
Think about it if the CD is executed. What's going to happen?
As a result, the table of contents did not jump and did not move in place. As shown in the following figure. Using this principle, you can use Cd.>test.txt to construct 0-byte text files. For more information, please refer to this article: the 2nd of my usual batch processing practical skills.
Originally, in the cmd,. 、.. and \ Represents a relative path,. Is the current directory, ... Is the previous level directory, and \ represents the root directory.
To see a more bizarre phenomenon:
When jumping from the current directory to a different partition path D:\, the CD d:\ did not succeed and the current directory did not change; when a parameter/D was added, the command was executed successfully. Originally, to jump to different partitions, you need to add the mandatory jump parameter/d. However, if you are entering a subdirectory of the current directory, you may not use the/d parameter. this point is very easy to be overlooked by everyone, hoping to arouse enough attention.
Let's look at a more bizarre phenomenon:
Originally, when the current drive letter + colon is entered, the full path to the current directory is displayed, and when the current drive letter + Colon + backslash is entered, it jumps to the root directory of the current path.
another very valuable use of CDs is to display the current full path, which is typically referenced by%cd%. as shown in the following figure. At this point, the CD will be interpreted as current Directory, that is, "present folder."
Advanced topic: What's the problem with the following picture?
The above mentioned is the entire content of this article, I hope you can enjoy.