DOS command dir use detailed

Source: Internet
Author: User
Tags file size root directory

As we said before, in DOS we command computer work by typing commands. So what we want to say into the computer, the computer can understand?

Obviously this is not possible, the computer under DOS can only understand the meaning of some special English command, only you enter these commands, the computer will listen to your command, otherwise it will only innocently said: "Bad command or file name." It's saying that it doesn't understand what you're saying. So, what are the commands in DOS?

Dos commands are divided into internal commands and external commands, and internal commands are loaded with Command.com, and the external command is a separate executable file.

Internal commands are concentrated in a Command.com file in the root directory, which is read into memory every time the computer is started, which means that when the computer is running, these internal commands reside in memory, and the internal commands are not visible with Dir. The external commands are stored in a separate file on the disk, they are the COM and exe-suffix files, they are not resident memory, only when the computer needs, will be transferred into memory.

Let's take a look at some of the most commonly used commands to get a better understanding of DOS commands. The most frequently used command in DOS is the dir command, which is the abbreviation for the English word directory (directory), which is used primarily to display files and subdirectories in a directory.

We can try to enter dir after the prompt, and then press ENTER enter, regardless of the case, if the input error, you can press the BACKSPACE key to amend. If you have a lot of files or subdirectories under the current directory, you will find that the content has not been seen clearly, and then a bit of a roll over?

Don't worry, want to see clearly is not simple, dir command can be with parameters, type dir/p try to see, this first computer in the display after a screen content, stopped.

See the last line of English does not, this line of English means: If you read this screen, you can knock a button to see the next screen. Then try a button, whichever is OK. Well, isn't it convenient to change a screen?

If you think it is too much trouble to use the dir/p screen, you try this command, and enter dir/w from the keyboard. This time all the files are displayed in a screen, but it seems to be missing something, the original file size and generation time have been omitted. If you only want to know what files and subdirectories are in the directory, and do not care about the time and size of the file generation, then using DIR/W, the short form of the display is a good choice.

The dir command not only allows you to see what files are in the directory, but also to view information about a file in the directory, such as entering DIR ABC, which is to view information about the file ABC in the current directory, including its size and build time.

If the dir ABC is executed, the display is "File not found." Indicates that there is no ABC in the current directory, so you can also use the DIR command to locate the file. For example, use the dir command to find out if there is a Win.com file in the current directory, just enter dir win.com.

The dir command can not only find and display a specific file, but also display a class of files. For example, enter Dir *.bat, which shows all files with the name extension bat. Look at the picture.

What does that mean here? In a DOS command, * appearing in the filename is meant to represent any character. For example, a.* represents the file base name is a, and the extension is any file. So dir a.* is a display of all files that have a file base name of a. What will happen if you a*.* with dir? The result is a display of all files whose base name begins with a. A little deeper, what does dir *.* mean? Where the file base and extension names are arbitrary, that means all files, so this is the same as just entering dir.

Because * can replace any character, so we call it a wildcard. In fact, the wildcard character is not only * one, now let's look at another wildcard----? 。

What is the difference between a wildcard and a *? * Can replace more than one character in the filename, and? can only be substituted for a single character in the filename. For example, A*.* is a file that starts with a basic name for all files, and a?. * is to represent the file base name is only two characters, and the first character is all files of a, empathy a??. * is the representative file base name is only three characters, and the first character is all files of a.

There is a difference between the two, in the file name after the *, all subsequent characters do not work, such as A*.* and a*b.* is no different, but A*.* and a*.com is different, because a separator in the interval, * can not exceed the role of the separator.

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.