DOS Overview and Getting Started _dos/bat

Source: Internet
Author: User
Tags current time parent directory
Most home computer operating systems are now Windows, but before the launch of the Windows95 in 1995, the dominant operating system was DOS (disk Operation system).

Contact the computer earlier people must have heard of the name of DOS, but also many people still remember the DOS era, although their own computer already used windows, but still have to keep a DOS on the hard drive, for a rainy day.

So where is the charm of DOS?

In the DOS environment, after the boot, we are not facing the desktop and icon, but this computer screen: This c:\〉 is called a prompt, this flashing horizontal line is called the cursor. This means that the computer is ready and waiting for us to give it an order. All we need to do now is to give commands to the computer, what commands the computer has, and what the computer will do. So how do we get to the computer to issue orders?

Very simple. For example, we want to see what time it is now, you can enter the hour command, type four letters of time, which in English is the meaning of "times", and then hit enter to confirm, when the screen shows the current time.

Then hit enter, and then a prompt, you can enter the next command.

If you want to see a date, enter date, and then hit enter to confirm. The current date is displayed on the screen. Hit enter again and return to the prompt.

This is the DOS command input method, and Windows95 use the mouse to look for the icon to run the program, DOS is through the input English command plus enter the way to execute the program.

What, like Windows is completely different? In the character interface, we can only use keyboard input characters to command the computer work, the computer completes a command, the next prompt, we can give the computer command. Note that in DOS, the computer can only do one thing at a time, and then you can start the next thing, but under windows, we might be able to do a couple of things at the same time, for example, we can copy files, write articles while browsing the Internet. So people call DOS a one-task operating system, while Windows 95 is called a multitasking operating system.

In DOS, files and directories are the most important concepts, as with Windows, and the directory is called a "folder" in Windows.

If we want to view the files on our computer, we can enter the dir command and return. It can be seen that the following is a directory with <dir>, there is no file, these directories are categorized in many different uses of the file.

In DOS, the file name rule is 8.3, which is a filename consisting of a file base name and file name extension, with a dot "." In the middle. Separated, the file base name consists of no more than 8 English letters or numbers, the file name extension consists of not more than three letters or numbers, the file base name must have, the extension can not.

Note: When displaying a list of files with the dir command, there is no "." Between the file base name and the extension. Separator, but you must enter it when you enter the full file name. The third column shows the size of the file, indicating how much storage space it occupies. That is, the amount of information contained in the file, the more information, the larger the file; The fourth column represents the date the file was created or the date it was last changed, and each file has a corresponding build time, just as everyone has their own birthdays, The generation time of the file is the time when the file is formed. The time uses the usual expression method, is composed by the year, the month, the day. The last column represents the time when the file was generated, and the last letter a indicates that the morning and p represent the afternoon.

Let's take a look at the bottom one or two lines, what do these mean? "File (s)" is to tell you that the directory contains "10" files, which add up to a total of "64,692 bytes" large, in this calculation, each subdirectory is a file, but its size is 0. The last line is to tell you that your current working disk is left with the "xxx bytes" size available on disk space.

If we want to look at the files in the DOS directory, then we can hit Dir dos return, which means looking at the DOS directory, if you knock dir windows return is to look at the Windows directory of the file meaning. You can try to practice the dir command and observe what is underneath the folder.

When you use the dir command to view files on a disk, you will find that there are many kinds of file suffixes (i.e. file extensions), most of which have some meaning.

Any file with a suffix of exe, COM, or bat can be executed directly. These exe-suffix files are called executable files, files with COM suffixes are called command files, and bat-suffix files are called batch files. If we want to execute these files, simply type the file base name at the prompt and then enter, without the need for a file suffix.

For example, the first line of this file is called Format.com, followed by the prefix named COM, if we want to execute it, simply type the file base name at the prompt and then enter it, do not need to enter the suffix name. (This is actually after we want to learn formatting command format, do not try to press the text input on the screen, or you will not have the information on a disk, etc. after learning the following chapters, you understand this command and then try again, now do not mess with!) )

For example, the second line of the file Mem.exe, followed by the prefix is an EXE, but also a executable file, its function is to see the computer's current memory footprint. Tap the mem at the prompt, and then enter. (This command is OK, you can try)

This shows how much memory the computer has in total, how much is being used, how much is left, how much basic memory is being used, and how much basic memory is left, which will be explained in detail below.

When we look at the file in the root of C disk, we tend to see the Autoexec.bat file, followed by bat, indicating that it is a batch file and can be executed directly.

The so-called batch processing, is to be able to execute a number of commands, when we want the computer to complete a series of tasks, you can execute a single command, you can put these commands into a
File, the computer will execute this batch of commands one at a time, just by knocking the file name.

In practice, we often create batch files to accomplish a lot of tedious work with fixed steps. Now, you already know which files in your computer are directly valid for you.
, they are files that are suffixes of COM, exe, or bat.

So, when you get a new software, you can start with the dir command to see if there are any files that have them as suffixes, in general, you can find one or a few such files, you can safely to implement them, which must have one is right, wrong also does not matter, generally will not have much impact.

In DOS, there is a concept of the current directory, which is the directory displayed by the prompt, now the prompt is C:\, then the current directory is the root of the C disk, which (backslash) represents the root directory.

If you want to change the current directory, then you can use the CD command, such as we enter CD DOS, means that the replacement of the current directory for the DOS directory, enter, you see, the prompt has become C:\DOS, which means that the current directory into the C disk DOS directory, the current directory what is the significance?

Here, we enter Dir to try, see, the files listed now are not just seen, these are the files in the DOS directory, which means that the dir command lists the contents of the current directory. Also, when we enter the executable file name, DOS will look for the file in the current directory, if not the file, Dos prompts the error message.

So what is the structure of the catalogue? The directory is a tree structure, you see, the following is a map of the directory structure, this c: the top level of the directory, called the root directory, the other
Directories are subdirectories of the root directory, such as Dos,windows,tools, and the Dos,windows directory itself has subdirectories, like the temp directory under DOS, and the system directory under WINDOWS.

We use the CD command to change the current directory, input CD DOS, then the current directory becomes DOS, sometimes we change the current directory as a subdirectory called into the subdirectory, that
We are now into the DOS directory, and then enter the CD temp, then we will enter the Temp directory, how to exit the Temp directory? Just type the CD ..., enter, and we can go back to the DOS directory. In DOS, this two o'clock represents the top level directory of the current directory, a point that represents the current directory, and sometimes we call the upper level directory the parent directory. Then enter the CD ... and then return to the root directory of C disk.

Entering a subdirectory of a directory does not require a single layer of access to the CD command, which can be done with one line of commands, such as entering the system subdirectory under the WINDOWS directory, as long as you enter a CD windows\system, or you can enter a CD C:\WINDOWS\ SYSTEM, if you want to go back to the root directory, you do not have to enter the CD multiple times. To complete, you can directly enter the CD \,\ to represent the root directory.

When you use the DIR command column file list in subdirectories, we find that. Counts as the number of files, but the size is zero.

What if we want to replace the current directory to other partitions on the hard drive? Of course not using CDs, otherwise I will not say, then should enter the letter and return. For example, to D, then enter D: And then return, see, now the prompt has become d:\〉. With the dir command, it's a list of D-disk files.

In fact, to fully express a subdirectory should be a disk alphanumeric directory, such as C: \dos\temp, so the complete expression of the file? is the disk alphanumeric directory plus file name, such as
C:\DOS\TEMP\ME. Txt,c:\dos\temp\ is called the ME.TXT path.

As we said earlier, when you enter an executable file name, DOS will look for the file in the current directory, if not found, will prompt the wrong file name, but we do not have to change the current directory to the directory where the file can run it, you can add the full path before the file name, For example, our current directory is C:\DOS, we want to run D:\TEST\PCT. EXE, then we can enter D:\TEST\PCT directly. EXE carriage return so that we can execute files in other directories without changing the current directory.

When the computer is just started, you must first read some of the system programs from a disk into the memory to work properly, we will call this disk as the boot disk.

Usually, we use a or C disk as the boot disk, in special cases, the other disk of the hard drive and a few computer discs can also be used as the boot disk. The SYS command is required to make a startup disk, which can be referred to later in the command section.

When the DOS system starts, read the two system files Io.sys, MSDOS from the boot disk first. SYS, and then locate and execute CONFIG in the root directory of the boot disk. SYS, Command.com, AUTOEXEC. Bat three files. Among them Io.sys, MSDOS. SYS and COMMAND. COM these three files are dispensable, Otherwise, the computer will not start properly. Config.sys and Autoexec.bat these two files are used to configure the system's operating environment and automate commands that are critical to the performance of the computer and to the drive of many devices, and we can modify their content to suit our needs. , Autoexec.bat is called an automatic batch file, which is one of the batch files because it is automatically run when DOS starts, so it is called an automatic batch file. You can put the program that you want to run every time you start your computer.

If the computer cannot find these two files in the root directory, it can be run, but there are many complex software and devices that will not work properly. such as optical drives, sound cards, and Windows programs. Therefore, beginners should be careful not to delete the above several files, otherwise, the computer will not work properly.

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.