Sender: mmbbooyy (QQPETER), Board: DOS
Title: Basic Usage of the DOS Operating System
Posting site: BBS Shuimu Tsinghua Station (Sun Jul 15 18:15:14 2001)
/---------------------------------------------------------------------\
\---------------------------------------------------------------------/
Section 1 Overview of the DOS Operating System
┏━━━━━━━━━━━┓
┃1.1 Development of the DOS Operating System ┃
┗━━━━━━━━━━━┛
The DOS operating system is the Disk Operating System, abbreviated as DOS. The widely used MS-DOS was named by Microsoft after it bought the patent rights to DOS. PC-DOS was IBM's renamed version of MS-DOS after IBM selected MS-DOS as the basic operating system when launching the IBM-PC. There is not much essential difference between MS-DOS and PC-DOS, and their commands are basically compatible.
The predecessor of MS-DOS was 86-DOS, released by Seatlle Computer Products in 1980. Microsoft bought the patent for 86-DOS in 1981, then modified and expanded it and renamed it MS-DOS, namely MS-DOS V1.0. With the continuous development of microcomputer hardware and software, Microsoft also kept updating DOS versions. From DOS V1.0 released in 1981 to today, it has gone through more than ten versions; the latest version at present is MS-DOS V6.22. Table 1.1 lists the different versions of MS-DOS and their main technical improvements.
Table 1.1 MS-DOS versions and their main technologies
┏━━━┯━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃Version│ Release time │ Main technical improvements ┃
┠───┼──────┼──────────────────────────┨
┃1.0 │July 1981 │ ┃
┠───┼──────┼──────────────────────────┨
┃2.25 │1982 │Added double-sided floppy disks ┃
┠───┼──────┼──────────────────────────┨
┃2.0 │March 1983 │Hard disks, tree structure ┃
┠───┼──────┼──────────────────────────┨
┃3.0 │August 1984 │1.2M floppy disks, RAM disk, volume label and ATTRIB command ┃
┠───┼──────┼──────────────────────────┨
┃3.1 │November 1984│Support for Microsoft network ┃
┠───┼──────┼──────────────────────────┨
┃3.2 │1986 │Support for 3.5-inch disks ┃
┠───┼──────┼──────────────────────────┨
┃3.3 │1987 │Support for 1.44M disks ┃
┠───┼──────┼──────────────────────────┨
┃4.0 │December 1989│Added MS-DOS Shell, large-capacity files and disks ┃
┠───┼──────┼──────────────────────────┨
┃5.0 │June 1991 │Memory management, task switching, EDIT, larger-capacity disks ┃
┠───┼──────┼──────────────────────────┨
┃6.0 │April 1993 │Multiple machine configurations, disk compression and optimization, virus prevention, Windows support ┃
┃ │ │and portable computers, communications and networking, file backup, deletion and protection, ┃
┃ │ │online help, memory management, etc. ┃
┗━━━┷━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━┛
┏━━━━━━━━━━━━┓
┃1.2 Main Functions and Composition of DOS ┃
┗━━━━━━━━━━━━┛
The main functions of DOS include: file management, storage management, device management, job management, and CPU management.
(1) File management:
File management means orderly management of all kinds of files in the computer. This includes: management of file identifiers, attributes, creation or modification times; management of file read/write operations; and management of operations such as file creation, searching, comparison, modification, deletion, and copying.
(2) Storage management:
Storage management uses DOS's dynamic storage management to manage operations such as allocating, requesting, releasing, and modifying memory blocks. Storage management can make it convenient for system programs and applications to effectively use the current memory capacity.
(3) Device management:
Device management uses DOS's device management programs and modules to effectively manage peripheral allocation, peripheral input/output operations, and buffers.
(4) Job management:
A job is an independent task that the user requests the computer system to complete. A job may include several processing steps such as input, compiling, linking, running, and output. Job management is the necessary resource scheduling and job processing control when many jobs are executed.
(5) CPU management:
The CPU is an important resource in a microcomputer system. CPU management is, first, to enable the CPU to operate efficiently, and second, to handle all possible interrupt events.
(6) Composition of DOS:
The main body of MS-DOS uses a hierarchical modular structure, consisting of a boot loader and three hierarchical modules, as shown in Figure 1 below.
┌────┐ ┌──────┐
│User ├─→│Keyboard Command │
└─┬──┘ └──┬───┘
│ ┌┈┈┈┈┼┈┈┈┈┈┈┐
│ ┊ ↓ ┊
│ ┊ ┌──────┐ ┊
│ ┊ │COMMAND.COM │ ┊
│ ┊ └──┬───┘ ┊
↓ ┊ ↓ ┊
┌────┐┊ ┌──────┐ ┊
│User Program├┼→│ MSDOS.SYS │ ┊
└────┘┊ └──┬───┘ ┊
┌┈┈┈┈┈┈┘ ↓ ┊DOS
┊┌────┐ ┌──────┐ ┊
┊│Boot loader│ │ IO.SYS │ ┊
┊└─┬──┘ └──┬───┘ ┊
└┈┈┼┈┈┈┈┈┈┈┈┼┈┈┈┈┈┈┘
│ ↓
│ ┌──────┐
└────→│ ROM BIOS │
└──────┘
Figure 1 DOS composition structure
①Boot loader (Boot record)
The boot loader is stored on side 0, track 0, sector 1 of the disk (the boot sector). When DOS starts, through the bootstrap program in the basic input/output system (ROM BIOS) stored in read-only memory, the boot loader is first loaded into memory, and then it loads the rest of DOS from the disk into memory.
②Input/output interface program (IO.SYS)
The input/output interface program is the lowest-level DOS module and is the interface between MSDOS.SYS and ROM BIOS. It includes all DOS function call modules and can perform operations on peripherals such as the display, keyboard, printer, communications port, clock, and counter. At the same time, when DOS starts, IO.SYS is also responsible for checking the devices connected to the computer system and setting up the devices that will be used, to ensure normal use when the system is running.
③File management and system call program (MSDOS.SYS)
This program is the core DOS module, including DOS internal command execution modules for file management, disk management, and other peripheral management. When DOS starts, MSDOS.SYS is loaded into memory and remains resident, responsible for initialization of internal work tables and file assembly tables, accepting calls to various DOS internal commands, etc.
④Keyboard command management program (COMMAND.COM)
The keyboard command management program is the interface between the user and DOS, stored on disk under the command filename COMMAND.COM. Its function is to accept commands typed by the user and analyze them. According to the command type (internal command or external command), it uses the corresponding processing program to interpret and execute it, and outputs the execution result on the display. If the command typed by the user is wrong, an error message is displayed.
┏━━━━━━━┓
┃1.3 Starting DOS ┃
┗━━━━━━━┛
(1) DOS startup methods
DOS startup includes two methods: cold boot and warm boot.
①Cold boot refers to starting the system by powering it on. The cold boot operation method is:
Boot from drive A (floppy disk)
a. Insert the floppy disk containing the DOS system into drive A and close the drive latch;
b. Turn on the display, printer (if any), and host power in sequence, and DOS startup begins.
Boot from drive C (hard disk)
a. Open the latch of drive A;
b. Turn on the display, printer, and host power in sequence.
②Warm boot is a DOS startup method used when the computer is running abnormally, has crashed, or after changing system parameter settings. The warm boot method is:
Press the Ctrl key, Alt key, and Del key at the same time.
(2) System initialization
After completing the DOS startup operation, the microcomputer system automatically enters system initialization. The main work of system initialization includes:
①Hardware device detection, including CPU chip detection, detection of other main chips (such as interrupt controller, DMA controller, etc.), ROM BIOS chip detection, memory chip detection, keyboard detection, display detection, disk device detection, and printer and serial port addresses, etc. In warm boot mode, the memory chips are not detected.
②Execute the bootstrap program in ROM BIOS to load the boot loader from disk into memory.
③Execute the boot loader to load the three DOS modules into memory and execute them.
④Find and execute CONFIG.SYS (system configuration program) and AUTOEXEC.BAT (batch file).
When A:\> (floppy boot) or C:\> (hard disk boot) appears on the display, it means DOS startup and system initialization are complete, and DOS commands can be accepted.
Section 2 Files and File Management
In a broad sense, a file is a collection of related information stored on a certain medium. In computers, a file generally specifically refers to a collection of related information stored on a storage medium. That is, a file may be various programs, data, text, graphics, and audio-video materials stored on cards, tapes, disks, CDs, etc.
Since the files we usually use most are disk files, we must deeply understand disk files and their management.
┏━━━━━━━━━┓
┃2.1 Files and File Directories┃
┗━━━━━━━━━┛
(1) Files
To use files and disks reasonably, you need to understand some of the DOS system's rules for file management.
①File name (File Name)
The DOS system stipulates: a file's filename consists of two parts: the main filename and the extension filename.
Filename naming rules:
a. The main filename consists of 1 to 8 legal characters; the extension filename consists of 1 to 3 legal characters.
b. The following DOS reserved characters cannot be used as filename characters:
* file wildcard , parallel parameter separator
? file wildcard . extension prefix
> operation redirection : disk designator
For example, the following filenames are legal:
COMMAND.COM AUTO.BAT LXX.DOC
The following filenames are illegal:
ABC/XY.BAS illegal character in the main filename
SAYON.EXEC extension exceeds three characters
.SYS no main filename
②File types
The main filename indicates the job or function of the file to the user. The extension is the mark of the file type and is usually given by the system. Common extension types include:
Executable files: .EXE (executable file) .COM (command file) .BAT (batch file)
Text files: .TXT (text file) .DOC (document file) .DAT (data file)
Source program files: .BAS (BASIC) .PAS (PASCAL) .C (C language)
.PRG (DBASE/FOX) .ASM (assembly)
Other files: .SYS (system file) .OVL (overlay file) .BAK (backup file)
③File wildcards
The DOS system provides two file wildcards, “*” and “?”, both of which can be used in the main filename or extension filename.
“*” represents any number of characters starting from that character, and “?” represents one character at that character position. For example:
*.* all files
A*.TXT all files whose main filename begins with A and whose extension is TXT
ABA?.* all files whose main filename begins with ABA and has no more than four characters
?A*.* all files whose second character in the main filename is A (including any extension and files without an extension)
In DOS file operation commands, some commands do not allow file wildcards (such as the TYPE command), and some commands may cause confusion if wildcards are used (such as the RENAME command). Special attention must be paid when using them.
④File attributes
In addition to a filename and file type, a file also has file attributes. File attributes include four types: System, ReadOnly, Hidden, and Archive. Their attribute characteristics are:
System attribute (S) indicates that the file is a DOS system file;
Read-only attribute (R) indicates that the file can only be read, and cannot be modified or deleted;
Hidden attribute (H) indicates that the filename is not displayed by ordinary display commands;
Archive attribute (A) indicates that the file has been modified since the last backup.
File attributes can be displayed or set through the DOS ATTRIB command.
(2) File directory
A file directory is similar to the chapter and section table of contents of a book; it is a directory showing a group of files. A disk has a relatively large capacity and can store many file directories. DOS organizes and manages disk files through file directories.
In a file directory, a directory entry is set up for each file, including information such as filename, length, creation or modification date and time, file attributes, and the starting address of the storage location.
(3) Directory structure
DOS file directories use a tree structure.
The tree directory structure is like an inverted tree. The root node in the tree is the root directory. From the root downward, each branch node is a subdirectory, and each leaf node is a file, as shown in Figure 2.
┌────┐
│Root directory\ │
└─┬──┘
┌───────┬───┴────┬───────┬─────┐
↓ ↓ ↓ ↓ ↓
┌────┐ ┌─────┐ ┌────┐ ┌──────┐ ┌──┐
│ BASIC │ │CONFIG.SYS│ │WINWORD │ │COMMAND.COM │ │DOS │
└─┬──┘ └─────┘ └─┬──┘ └──────┘ └┬─┘
├───────┐ ┌──┴──┐ ┌────┴┐
↓ ↓ ↓ ↓ ↓ ↓
┌─────┐┌─────┐┌────┐┌────┐┌────┐┌──┐
│BASIC.EXE ││BASIC.BAS ││TEMPLATE││LETTERS ││ANSI.SYS││VDIF│
└─────┘└─────┘└─┬──┘└─┬──┘└────┘└┬─┘
↓ ↓ ↓
┌─────┐┌──────┐ ┌─────┐
│NORMAL.DOT││OTHER10.DOT │ │ACER10.DOT│
└─────┘└──────┘ └─────┘
Figure 2 Schematic diagram of tree directory structure
In the figure, BASIC, WINWORD, DOS, TEMPLATE, LETTERS, and VDIF are all branch nodes, that is, subdirectories; CONFIG.SYS, COMMAND.COM, BASIC.EXE, ANSI.SYS, NORMAL.DOT, OTHER10.DOT, and ACER10.VDB are all leaf nodes, that is, files.
The characteristics of the tree directory structure are:
①In multi-level directories, multiple files with the same name are allowed as long as they are in different directories;
②A disk has only one root directory. The root directory has no directory name and is generally represented by “\”. For example: C:\> indicates the root directory of drive C;
③Subdirectory naming rules are the same as filename rules, but subdirectory names generally do not use extensions. A subdirectory name cannot duplicate a file name at the same level;
④Each subdirectory has two special file directory entries: the first is “.”, containing directory information about the subdirectory itself; the second is “..”, containing information about the parent directory. These two directory entries are automatically created when the subdirectory is created.
(4) Current disk and current directory
The “current” disk and “current” directory are the system's default operating objects. If the user does not explicitly specify the operating object, the system operates on the “current” object.
Generally, after DOS starts, it automatically takes the boot disk and that disk's root directory as the system's default operating objects, namely the current disk and current directory. For example: after booting from the hard disk, the screen displays C:\>, indicating that drive C is the current disk and the root directory of drive C is the current directory.
Each disk has its own current directory. If a disk directory contains multiple subdirectories, there will be multiple current directories. For a disk operated on for the first time, its current directory is the root directory.
┏━━━━┓
┃2.2 Path┃
┗━━━━┛
(1) Path
A path (PATH) refers to the combination of channels passed through from the root directory or current directory to the directory where the object to be accessed (file or directory) is located.
There are two kinds of paths: absolute paths and relative paths:
An absolute path is expressed by a group of subdirectory names passed through from the root directory to the specified file (or directory), and must begin with “\”. That is:
\subdirectory name 1\subdirectory name 2\……
For example:
┌┈┈┈┐ ┌┈┈┈┈┈┈┈┈┐
┊ C:\> ┊DIR┊\LXX ┊
┊ C:\> ┊DIR┊\LXX\USER ┊
┊ C:\> ┊DIR┊\LXX\USER\READ ┊
└┈┬┈┘ └┈┈┈┬┈┈┈┈┘
↓ ↓
Current directory (root directory) Absolute path
A relative path is expressed by a group of subdirectory names passed through from the current directory to the specified file (or directory). That is:
subdirectory name 1\subdirectory name 2\……
For example:
┌┈┈┈┈┈┈┈┈┈┐ ┌┈┈┈┈┈┐
┊C:\LXX> ┊DIR┊USER\READ ┊
┊C:\LXX\USER> ┊DIR┊READ\HZK ┊
┊C:\LXX\USER\READ> ┊DIR┊HT ┊
└┈┈┈┈┬┈┈┈┈┘ └┈┈┬┈┈┘
↓ ↓
Current directory Relative directory
(2) File identification
Since the tree file directory structure used by DOS allows multiple files with the same name to exist in different subdirectories, when using it, the file identification must be used to determine which file is to be operated on.
A file identification consists of three parts: drive letter, path, and filename, namely:
In this, “:” indicates the disk where the file is stored, which can be A:, B:, C:, D:, …… respectively indicating drive A, drive B, drive C, drive D, etc. If it is the current drive, it can be omitted; it can be represented by an absolute path or a relative path.
----------------------------------------------
Title: Basic Usage of the DOS Operating System
Posting site: BBS Shuimu Tsinghua Station (Sun Jul 15 18:15:14 2001)
/---------------------------------------------------------------------\
\---------------------------------------------------------------------/
Section 1 Overview of the DOS Operating System
┏━━━━━━━━━━━┓
┃1.1 Development of the DOS Operating System ┃
┗━━━━━━━━━━━┛
The DOS operating system is the Disk Operating System, abbreviated as DOS. The widely used MS-DOS was named by Microsoft after it bought the patent rights to DOS. PC-DOS was IBM's renamed version of MS-DOS after IBM selected MS-DOS as the basic operating system when launching the IBM-PC. There is not much essential difference between MS-DOS and PC-DOS, and their commands are basically compatible.
The predecessor of MS-DOS was 86-DOS, released by Seatlle Computer Products in 1980. Microsoft bought the patent for 86-DOS in 1981, then modified and expanded it and renamed it MS-DOS, namely MS-DOS V1.0. With the continuous development of microcomputer hardware and software, Microsoft also kept updating DOS versions. From DOS V1.0 released in 1981 to today, it has gone through more than ten versions; the latest version at present is MS-DOS V6.22. Table 1.1 lists the different versions of MS-DOS and their main technical improvements.
Table 1.1 MS-DOS versions and their main technologies
┏━━━┯━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃Version│ Release time │ Main technical improvements ┃
┠───┼──────┼──────────────────────────┨
┃1.0 │July 1981 │ ┃
┠───┼──────┼──────────────────────────┨
┃2.25 │1982 │Added double-sided floppy disks ┃
┠───┼──────┼──────────────────────────┨
┃2.0 │March 1983 │Hard disks, tree structure ┃
┠───┼──────┼──────────────────────────┨
┃3.0 │August 1984 │1.2M floppy disks, RAM disk, volume label and ATTRIB command ┃
┠───┼──────┼──────────────────────────┨
┃3.1 │November 1984│Support for Microsoft network ┃
┠───┼──────┼──────────────────────────┨
┃3.2 │1986 │Support for 3.5-inch disks ┃
┠───┼──────┼──────────────────────────┨
┃3.3 │1987 │Support for 1.44M disks ┃
┠───┼──────┼──────────────────────────┨
┃4.0 │December 1989│Added MS-DOS Shell, large-capacity files and disks ┃
┠───┼──────┼──────────────────────────┨
┃5.0 │June 1991 │Memory management, task switching, EDIT, larger-capacity disks ┃
┠───┼──────┼──────────────────────────┨
┃6.0 │April 1993 │Multiple machine configurations, disk compression and optimization, virus prevention, Windows support ┃
┃ │ │and portable computers, communications and networking, file backup, deletion and protection, ┃
┃ │ │online help, memory management, etc. ┃
┗━━━┷━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━┛
┏━━━━━━━━━━━━┓
┃1.2 Main Functions and Composition of DOS ┃
┗━━━━━━━━━━━━┛
The main functions of DOS include: file management, storage management, device management, job management, and CPU management.
(1) File management:
File management means orderly management of all kinds of files in the computer. This includes: management of file identifiers, attributes, creation or modification times; management of file read/write operations; and management of operations such as file creation, searching, comparison, modification, deletion, and copying.
(2) Storage management:
Storage management uses DOS's dynamic storage management to manage operations such as allocating, requesting, releasing, and modifying memory blocks. Storage management can make it convenient for system programs and applications to effectively use the current memory capacity.
(3) Device management:
Device management uses DOS's device management programs and modules to effectively manage peripheral allocation, peripheral input/output operations, and buffers.
(4) Job management:
A job is an independent task that the user requests the computer system to complete. A job may include several processing steps such as input, compiling, linking, running, and output. Job management is the necessary resource scheduling and job processing control when many jobs are executed.
(5) CPU management:
The CPU is an important resource in a microcomputer system. CPU management is, first, to enable the CPU to operate efficiently, and second, to handle all possible interrupt events.
(6) Composition of DOS:
The main body of MS-DOS uses a hierarchical modular structure, consisting of a boot loader and three hierarchical modules, as shown in Figure 1 below.
┌────┐ ┌──────┐
│User ├─→│Keyboard Command │
└─┬──┘ └──┬───┘
│ ┌┈┈┈┈┼┈┈┈┈┈┈┐
│ ┊ ↓ ┊
│ ┊ ┌──────┐ ┊
│ ┊ │COMMAND.COM │ ┊
│ ┊ └──┬───┘ ┊
↓ ┊ ↓ ┊
┌────┐┊ ┌──────┐ ┊
│User Program├┼→│ MSDOS.SYS │ ┊
└────┘┊ └──┬───┘ ┊
┌┈┈┈┈┈┈┘ ↓ ┊DOS
┊┌────┐ ┌──────┐ ┊
┊│Boot loader│ │ IO.SYS │ ┊
┊└─┬──┘ └──┬───┘ ┊
└┈┈┼┈┈┈┈┈┈┈┈┼┈┈┈┈┈┈┘
│ ↓
│ ┌──────┐
└────→│ ROM BIOS │
└──────┘
Figure 1 DOS composition structure
①Boot loader (Boot record)
The boot loader is stored on side 0, track 0, sector 1 of the disk (the boot sector). When DOS starts, through the bootstrap program in the basic input/output system (ROM BIOS) stored in read-only memory, the boot loader is first loaded into memory, and then it loads the rest of DOS from the disk into memory.
②Input/output interface program (IO.SYS)
The input/output interface program is the lowest-level DOS module and is the interface between MSDOS.SYS and ROM BIOS. It includes all DOS function call modules and can perform operations on peripherals such as the display, keyboard, printer, communications port, clock, and counter. At the same time, when DOS starts, IO.SYS is also responsible for checking the devices connected to the computer system and setting up the devices that will be used, to ensure normal use when the system is running.
③File management and system call program (MSDOS.SYS)
This program is the core DOS module, including DOS internal command execution modules for file management, disk management, and other peripheral management. When DOS starts, MSDOS.SYS is loaded into memory and remains resident, responsible for initialization of internal work tables and file assembly tables, accepting calls to various DOS internal commands, etc.
④Keyboard command management program (COMMAND.COM)
The keyboard command management program is the interface between the user and DOS, stored on disk under the command filename COMMAND.COM. Its function is to accept commands typed by the user and analyze them. According to the command type (internal command or external command), it uses the corresponding processing program to interpret and execute it, and outputs the execution result on the display. If the command typed by the user is wrong, an error message is displayed.
┏━━━━━━━┓
┃1.3 Starting DOS ┃
┗━━━━━━━┛
(1) DOS startup methods
DOS startup includes two methods: cold boot and warm boot.
①Cold boot refers to starting the system by powering it on. The cold boot operation method is:
Boot from drive A (floppy disk)
a. Insert the floppy disk containing the DOS system into drive A and close the drive latch;
b. Turn on the display, printer (if any), and host power in sequence, and DOS startup begins.
Boot from drive C (hard disk)
a. Open the latch of drive A;
b. Turn on the display, printer, and host power in sequence.
②Warm boot is a DOS startup method used when the computer is running abnormally, has crashed, or after changing system parameter settings. The warm boot method is:
Press the Ctrl key, Alt key, and Del key at the same time.
(2) System initialization
After completing the DOS startup operation, the microcomputer system automatically enters system initialization. The main work of system initialization includes:
①Hardware device detection, including CPU chip detection, detection of other main chips (such as interrupt controller, DMA controller, etc.), ROM BIOS chip detection, memory chip detection, keyboard detection, display detection, disk device detection, and printer and serial port addresses, etc. In warm boot mode, the memory chips are not detected.
②Execute the bootstrap program in ROM BIOS to load the boot loader from disk into memory.
③Execute the boot loader to load the three DOS modules into memory and execute them.
④Find and execute CONFIG.SYS (system configuration program) and AUTOEXEC.BAT (batch file).
When A:\> (floppy boot) or C:\> (hard disk boot) appears on the display, it means DOS startup and system initialization are complete, and DOS commands can be accepted.
Section 2 Files and File Management
In a broad sense, a file is a collection of related information stored on a certain medium. In computers, a file generally specifically refers to a collection of related information stored on a storage medium. That is, a file may be various programs, data, text, graphics, and audio-video materials stored on cards, tapes, disks, CDs, etc.
Since the files we usually use most are disk files, we must deeply understand disk files and their management.
┏━━━━━━━━━┓
┃2.1 Files and File Directories┃
┗━━━━━━━━━┛
(1) Files
To use files and disks reasonably, you need to understand some of the DOS system's rules for file management.
①File name (File Name)
The DOS system stipulates: a file's filename consists of two parts: the main filename and the extension filename.
Filename naming rules:
a. The main filename consists of 1 to 8 legal characters; the extension filename consists of 1 to 3 legal characters.
b. The following DOS reserved characters cannot be used as filename characters:
* file wildcard , parallel parameter separator
? file wildcard . extension prefix
> operation redirection : disk designator
For example, the following filenames are legal:
COMMAND.COM AUTO.BAT LXX.DOC
The following filenames are illegal:
ABC/XY.BAS illegal character in the main filename
SAYON.EXEC extension exceeds three characters
.SYS no main filename
②File types
The main filename indicates the job or function of the file to the user. The extension is the mark of the file type and is usually given by the system. Common extension types include:
Executable files: .EXE (executable file) .COM (command file) .BAT (batch file)
Text files: .TXT (text file) .DOC (document file) .DAT (data file)
Source program files: .BAS (BASIC) .PAS (PASCAL) .C (C language)
.PRG (DBASE/FOX) .ASM (assembly)
Other files: .SYS (system file) .OVL (overlay file) .BAK (backup file)
③File wildcards
The DOS system provides two file wildcards, “*” and “?”, both of which can be used in the main filename or extension filename.
“*” represents any number of characters starting from that character, and “?” represents one character at that character position. For example:
*.* all files
A*.TXT all files whose main filename begins with A and whose extension is TXT
ABA?.* all files whose main filename begins with ABA and has no more than four characters
?A*.* all files whose second character in the main filename is A (including any extension and files without an extension)
In DOS file operation commands, some commands do not allow file wildcards (such as the TYPE command), and some commands may cause confusion if wildcards are used (such as the RENAME command). Special attention must be paid when using them.
④File attributes
In addition to a filename and file type, a file also has file attributes. File attributes include four types: System, ReadOnly, Hidden, and Archive. Their attribute characteristics are:
System attribute (S) indicates that the file is a DOS system file;
Read-only attribute (R) indicates that the file can only be read, and cannot be modified or deleted;
Hidden attribute (H) indicates that the filename is not displayed by ordinary display commands;
Archive attribute (A) indicates that the file has been modified since the last backup.
File attributes can be displayed or set through the DOS ATTRIB command.
(2) File directory
A file directory is similar to the chapter and section table of contents of a book; it is a directory showing a group of files. A disk has a relatively large capacity and can store many file directories. DOS organizes and manages disk files through file directories.
In a file directory, a directory entry is set up for each file, including information such as filename, length, creation or modification date and time, file attributes, and the starting address of the storage location.
(3) Directory structure
DOS file directories use a tree structure.
The tree directory structure is like an inverted tree. The root node in the tree is the root directory. From the root downward, each branch node is a subdirectory, and each leaf node is a file, as shown in Figure 2.
┌────┐
│Root directory\ │
└─┬──┘
┌───────┬───┴────┬───────┬─────┐
↓ ↓ ↓ ↓ ↓
┌────┐ ┌─────┐ ┌────┐ ┌──────┐ ┌──┐
│ BASIC │ │CONFIG.SYS│ │WINWORD │ │COMMAND.COM │ │DOS │
└─┬──┘ └─────┘ └─┬──┘ └──────┘ └┬─┘
├───────┐ ┌──┴──┐ ┌────┴┐
↓ ↓ ↓ ↓ ↓ ↓
┌─────┐┌─────┐┌────┐┌────┐┌────┐┌──┐
│BASIC.EXE ││BASIC.BAS ││TEMPLATE││LETTERS ││ANSI.SYS││VDIF│
└─────┘└─────┘└─┬──┘└─┬──┘└────┘└┬─┘
↓ ↓ ↓
┌─────┐┌──────┐ ┌─────┐
│NORMAL.DOT││OTHER10.DOT │ │ACER10.DOT│
└─────┘└──────┘ └─────┘
Figure 2 Schematic diagram of tree directory structure
In the figure, BASIC, WINWORD, DOS, TEMPLATE, LETTERS, and VDIF are all branch nodes, that is, subdirectories; CONFIG.SYS, COMMAND.COM, BASIC.EXE, ANSI.SYS, NORMAL.DOT, OTHER10.DOT, and ACER10.VDB are all leaf nodes, that is, files.
The characteristics of the tree directory structure are:
①In multi-level directories, multiple files with the same name are allowed as long as they are in different directories;
②A disk has only one root directory. The root directory has no directory name and is generally represented by “\”. For example: C:\> indicates the root directory of drive C;
③Subdirectory naming rules are the same as filename rules, but subdirectory names generally do not use extensions. A subdirectory name cannot duplicate a file name at the same level;
④Each subdirectory has two special file directory entries: the first is “.”, containing directory information about the subdirectory itself; the second is “..”, containing information about the parent directory. These two directory entries are automatically created when the subdirectory is created.
(4) Current disk and current directory
The “current” disk and “current” directory are the system's default operating objects. If the user does not explicitly specify the operating object, the system operates on the “current” object.
Generally, after DOS starts, it automatically takes the boot disk and that disk's root directory as the system's default operating objects, namely the current disk and current directory. For example: after booting from the hard disk, the screen displays C:\>, indicating that drive C is the current disk and the root directory of drive C is the current directory.
Each disk has its own current directory. If a disk directory contains multiple subdirectories, there will be multiple current directories. For a disk operated on for the first time, its current directory is the root directory.
┏━━━━┓
┃2.2 Path┃
┗━━━━┛
(1) Path
A path (PATH) refers to the combination of channels passed through from the root directory or current directory to the directory where the object to be accessed (file or directory) is located.
There are two kinds of paths: absolute paths and relative paths:
An absolute path is expressed by a group of subdirectory names passed through from the root directory to the specified file (or directory), and must begin with “\”. That is:
\subdirectory name 1\subdirectory name 2\……
For example:
┌┈┈┈┐ ┌┈┈┈┈┈┈┈┈┐
┊ C:\> ┊DIR┊\LXX ┊
┊ C:\> ┊DIR┊\LXX\USER ┊
┊ C:\> ┊DIR┊\LXX\USER\READ ┊
└┈┬┈┘ └┈┈┈┬┈┈┈┈┘
↓ ↓
Current directory (root directory) Absolute path
A relative path is expressed by a group of subdirectory names passed through from the current directory to the specified file (or directory). That is:
subdirectory name 1\subdirectory name 2\……
For example:
┌┈┈┈┈┈┈┈┈┈┐ ┌┈┈┈┈┈┐
┊C:\LXX> ┊DIR┊USER\READ ┊
┊C:\LXX\USER> ┊DIR┊READ\HZK ┊
┊C:\LXX\USER\READ> ┊DIR┊HT ┊
└┈┈┈┈┬┈┈┈┈┘ └┈┈┬┈┈┘
↓ ↓
Current directory Relative directory
(2) File identification
Since the tree file directory structure used by DOS allows multiple files with the same name to exist in different subdirectories, when using it, the file identification must be used to determine which file is to be operated on.
A file identification consists of three parts: drive letter, path, and filename, namely:
In this, “:” indicates the disk where the file is stored, which can be A:, B:, C:, D:, …… respectively indicating drive A, drive B, drive C, drive D, etc. If it is the current drive, it can be omitted; it can be represented by an absolute path or a relative path.
----------------------------------------------
Recent Ratings for This Post
( 2 in total)
Click for details
| Rater | Score | Time |
|---|---|---|
| — | +1 | 2008-11-11 22:42 |
| zzz19760225 | +2 | 2017-10-31 14:22 |
ko20010214
=================================
大功告成,打个Kiss!
ko20010214@MSN.com
神州优雅Q300C
Intel CeleronM 370处理器 | 256MbDDR内存
40G硬盘 | USB2.0 | IEEE 1394
13.3 ' WXGA 宽屏(16:10) | COMBO光驱
10/100M网卡 | 四合一读卡器
=================================
大功告成,打个Kiss!
ko20010214@MSN.com
神州优雅Q300C
Intel CeleronM 370处理器 | 256MbDDR内存
40G硬盘 | USB2.0 | IEEE 1394
13.3 ' WXGA 宽屏(16:10) | COMBO光驱
10/100M网卡 | 四合一读卡器

DigestI



