DOS command beginner basic knowledge learning



DOS basic command

CD change the current directory sys make DOS system disk

Copy file del delete file

Deltree delete directory tree dir column file name

DiskCopy disk edit text editing

Format format disk MD create subdirectory

MEM view memory status type display file content

Rd delete directory Ren change file name

Remember how much ah, forget to go to class and have a look. The following four commands are new. Give the command format. Try it yourself. The important thing in learning computer is to explore.

CLS clear screen

[applicable occasion] if the screen is too messy, or there are garbled codes on the screen, clear the contents displayed on the screen without affecting any information inside the computer

CLS enter

Move move the file and change the directory name

[where applicable] move files to another directory

[method] move [file name] [directory] move the file to a new directory

Move [directory name] [directory name] change directory name

[example] C: \ > move C: \ Autoexec bat c:\old??

Move Autoexec Bat file to old directory

        c:\>move c:\config.sys c:\old??

Move config Sys file to old directory

Split screen display

[applicable occasion] it is used when there are many outputs and it cannot be displayed on one screen. It is suitable for almost all commands, especially for commands such as type. When using more, the disk cannot be write protected and is not suitable for optical drive.

[usage] type [file name] | more split screen display of file content

More < [file name] split screen display of file content

[example] C: \ > type MSDOS w40 | more

Xcopy copy directories and files

[applicable] it is very useful when copying together with subdirectories. It is much faster than the copy command when copying a large number of files

[method] xcopy [file name] [directory] copies the specified file to the specified directory

Xcopy [source directory] [destination directory] test the source directory and subdirectories to the destination directory

xcopy *.* [directory] / s copies files and non empty subdirectories to the specified directory

Other common parameters include: V verification after copying, which will affect the speed
E is similar to s, but it will be copied even if the subdirectory is empty.
Help help

[applicable occasion] it is used when you want to know how to use DOS commands

Help provides help for all DOS commands

Help [DOS command] provides help on commands

If you only remember a command roughly, you can directly enter the help command at the prompt, and then the following screen will appear:

Attrib setting file properties

[applicable occasion] when you want to make special treatment to the document

[usage] attrib displays the attributes of all files

Attrib + R or – R [file name] sets whether the file attribute is read-only

Attrib + H or – H [file name] sets whether the file attribute is implied

Attrib + s or – s [file name] sets whether the file attribute is a system file

Attrib + A or – a [file name] sets whether the file attribute is an archive file

Attrib / s sets file attributes including files in subdirectories

[example] C: \ test > attrib + R wina20 three hundred and eighty-six

C:\>attrib +h *.* / s?? Implied all files

Date displays and modifies the date

[where applicable] want to know or modify the time and date

Date displays and changes the current date

[example] C: \ > date 09-20-1996?? Change the date to September 20, 1996


          Current date is Tue 08-20-1996

          Enter new date (mm-dd-yy):09-20-1996

Modify the current date in the order of month, day and year. Press enter directly to ignore the modified date

Lable set volume label

[applicable] used to mark the disk

Label displays the disk volume label

Label [drive letter] [volume label name] sets the volume label of the specified disk

[example] C: \ > label??
        Volume in drive C is WANG
        Volume Serial Number is 2116-1DD0
        volume label (11 characters,Enter for none)?
You can enter the volume label and press enter directly
        Delete current volume label (Y/N)?
Press y to delete the old volume label, and press n not to change


Defrag disk defragmentation

[applicable occasion] the disk is read and written many times, or the disk has been used for a long time. You may need to use this command to clean up the disk. Disk fragmentation does not mean that the disk is broken, but only because the disk will be used incoherently after multiple copies and deletion of files, resulting in slower speed.

[method] 1 C:\>defrag??

2. Select the disk to be defragmented

        3. The computer analyzes the condition of the disk and then tells us how many disks need to be cleaned up. Press ESC

        4. Select optimization method, optimize all or optimize files only

        5. Select begin optimization to start grooming

6. After sorting, press enter

        7. Press ESC to exit.
Doskey calls and establishes DOS macro commands

[application] it is very useful when you often need to input repeated commands


Store doskey in memory and open up a buffer. Later input commands will be saved in the buffer and can be called at any time

Doskey [macro command name] = [command name]

Macro commands are defined as commands. After entering macro commands, the computer will execute the corresponding commands

Doskey / reinstall reinstall doskey

Doskey / bufsize = set buffer size

Doskey / macros displays all doskey macros

Doskey / history displays all commands in memory

Doskey / insert|override sets whether newly typed characters overwrite old characters

[example] C: \ > doskey??
        C:\>copy C:\temp\*.* a:
        C:\>del c:\temp\*.*
        C:\>copy b:\*.* c:\temp

The above four commands have been saved. Use the cursor control keys up and down to select or modify them in turn, or press F7 to list all the saved commands

C:\>doskey di=dir/w/p?? Di is defined as a macro command, which means executing dir / w / P

Fdisk hard disk partition

[suggestion] only when the hard disk is infected by a very important virus, or a new hard disk needs to be partitioned. It’s best to ask a knowledgeable person for guidance. Hard disks need to go through three steps: low-level formatting, partitioning and formatting before they can be used. The hard disks in the finished computer have been processed.

[usage] enter fdisk and press enter to enter the prompt interface


Memory expansion em386

[suggestion] this command is relatively complex, and will be described in detail in the system configuration in Chapter 5

LH / loadweight loads the program into high-end memory

This command is generally used in Autoexec Bat is useful when some software requires a large amount of basic memory

[method] LH [procedure]

Load the program into high-end memory. When using this command, config The following two statements are required in the sys file. device=emm386. exe dos=umb

LH [program] / L: area code loads the program into the specified UMB area

LH / S is generally dedicated by MemMaker

[example] C: \ mouse \ > LH mouse?? Load the mouse driver into high-end memory

MemMaker memory optimization management

[applicable occasion] this command is rarely used now. When DOS was popular in those years, you can’t play games without it. It can free up a lot of basic memory for games. You only need to install it once

[method] 1 C:\>memmaker??

2. Press enter to continue and F3 to exit

3. Select manual installation and automatic installation. Enter directly means automatic installation (enter)

4. Select whether there is a program that needs to expand memory. You can use the space bar to select. Yes means yes, No. just press enter.

5. The program automatically detects whether windows is installed in the hard disk

6. If there is a floppy disk in the floppy drive, take it out, and then press the Enter key. The computer will restart twice without interruption. Just press the Enter key.

(it’s actually very simple. Just press enter all the time, hehe)

MSD system detection

[applicable] used to check system information

[method] 1 C: \ > MSD after entering, you can see the following screen. A note is added next to each option to indicate the function of the button

??         2. Select the item to be queried, such as the first computer, and a dialog box will pop up to display some basic information of the computer. You can try other options to see what they do.

        3. Press Alt + F to activate the drop-down menu and select “exit” to exit.

Undelete recover deleted files

[application] it can be used when you accidentally delete the wrong document.

When DOS deletes a file, it only removes the file from the allocation table and deletes the first letter of the file name in the disk storage area. The file content is not immediately deleted from the disk, so it can be restored.

Undelete recover deleted files

Undelete / all restores the file without asking whether to restore it
The first one is “#%&-0123456789abcdefghijklmnopqrstuvwxyz”
Letters to recover files

Undelete / list column recoverable file name

Undelete / s can host undelete in memory, but few people use it like this
Prompt setting prompt

[applicable occasion] when you are tired of the prompt of C: \ > or you want to make your prompt different from others, you can try the very interesting DOS command, which can display the time and date at any time.

[usage] prompt $p $g takes the current directory name and > number as the prompt, which is the most commonly used prompt

Prompt $t represents the time and prompt $d represents the date

Prompt $$means $prompt $Q means=

Prompt $V represents the current version, prompt $l represents<

Prompt $B means | prompt $h means a fallback

Prompt $e represents the character prompt represented by ESC$_ Indicates carriage return and line feed

[example] C: \ DOS > prompt Wang $g?? Use Wang > as the prompt

WANG>prompt $t$d$g?? Use the time, date, and > as a prompt

        0:01:07.77Thu 08-29-1996>prompt $p$g??



Restore restores backed up files

[suggestion] if backup has been used for file backup before, it can be used to recover the file when the original file is damaged.

Restore the files in the disk backed up with the backup command to another disk. There should be backup in the backup disk 00x and control 00x these two files.

[usage] restore [backup drive letter] [target drive letter]

Restore the backup files on the backup disk to the specified disk

Restore / s restores the backup files, including subdirectories, to the specified disk

Restore / P allows the user to determine whether to restore files

Restore / B: restore files before the date

Restore / A: files after the restore date

Restore / L: restore files before time

Restore / E: files after recovery time

Restore / M restores only files that have been modified since the last backup

Restore / N restores only files that have been deleted since the last backup

Restore / D displays only the file names to be restored

[example] C: \ DOS > restore a: C:??
        Insert backup diskette 01 in drive A:
        Press any key to continue . . .

Put the first backup disk in drive a and press any key. After restoring the first disk, put other disks in order.

When you cannot recover the file correctly with the above command, please use:

        C:\DOS>restore a: c:\ /s??
Time display and modification time

[applicable occasion] it is used to display and modify the time. The usage is the same as date

[example] C: \ \ DOS > time??
        Current time is 12:15:26.04a
        Enter new time: 11:20:20.00p

On time: enter the time in sequence, and then add the afternoon (A / P). Press enter directly to ignore the modification time.

Set set environment variable

[applicable occasion] used when setting sound card and path, etc

[usage] set [environment variable] = [string]

This command is often used in Autoexec In bat

[example] C: \ > set blaster = a220 i5 D1 set the parameters of the sound card

C: \ > set path = C: \ DOS path C: \ DOS has the same meaning

Smartdrv set up disk accelerator

[suggestion] it can improve the access speed of hard disk, preferably in Autoexec Bat file.

[usage] smartdrv / X

It is a common method to execute and reside memory, open up disk acceleration cache area, and mask all drive cache (generally, this command is enough)

Smartdrv / C writes all the information in the cache to the hard disk

Smartdrv / E: number sets the amount of information to be moved at a time

Smartdrv / B: number sets the size of the buffer read in advance
Append sets the path of the non executable file

[applicable occasion] when you can’t find the document you entered in multiple directories, you can try this command. The usage is similar to path.

[method] append [path]; [path]

[example] C: \ > append C: \ test??

Set the path to find non executable files to C: \ \ test. If there are files in this directory, 1 Txt, call 1. TXT in other directories Txt cannot be found, the C: \ \ test directory can be found automatically.

D:\UCDOS>edit 1. Txt can be found in C: \ test \ 1 Txt file

Debug program debugging command

If you haven’t learned the language, you’d better not use it

[usage] debug [file name]

Diskcomp compare disks

[applicable occasion] compare whether the two disks are the same. I didn’t expect to be used when. When comparing the two disks copied with DiskCopy, why don’t you use DiskCopy / V verification?

[usage] diskcomp [drive letter 1] [drive letter 2] Compare disk 1 and disk 2

Diskcomp / 1 compares only the first side of the disk

Diskcomp / 8 compares only the first eight sectors without tracks

[example] C: \ > diskcomp A: A:
Compare two disks in the same floppy drive

        Insert FIRST diskette in drive A:
Put in the first plate

        Press any key to continue . . .

        Comparing 80 tracks 18 sectors per track, 2 side(s)   
        Insert SECOND diskette in drive A:
Put in the second plate

        Press any key to continue . . . Compare OK
The comparison found no difference

        Compare another diskette (Y/N) ?n
Whether to compare other disks, select y to continue the comparison, and select n to stop
Expand decompression tool

[applicable] there are many suffixes with “” in the original installation disk of Microsoft software The compressed file at the end can be decompressed with it to relieve the trouble caused by the loss of a few files.

Expand [source file name] [destination file]

[example] C: \ > expand a: vsafe co_ c:\dos\vsafe. com

? Check box? vsafe. co_ For vsafe Com file

        Microsoft (R) File Expansion Utility Version 2.10 Copyright (C) Microsoft Corp 1990-1993. All rights reserved.

        Expanding a:vsafe.co_ to c:\dos\ a:vsafe.co_:33046 bytes expanded to 62576 bytes, 89% increase.


FastHelp quickly displays help information

[suggestion] you can look at all commands. For a single command, it’s better to add /? Convenient parameters

[usage] FastHelp lists the uses of all DOS commands

FastHelp [command name] displays the purpose of the command, which is equivalent to [command name] /?

FC file comparison

[suggestion] Maybe most people will never use it

[method] FC [file name 1] [file name 2] compare the different parameters of the two files: a C L LBN t w nnnn

[example] C: \ test > FC a.bat b.bat??
        Comparing files A.BAT and B.BAT
        ***** A.BAT
        choice /c:dme defrag,mem,end
        if errorlevel 3 goto defrag
        if errorlevel 2 goto mem
        if errotlevel 1 goto end
        ***** B.BAT choice /c:dme defrag,mem,end
        ***** C:\TEST>
INTERLNK start simple network client

[application] if there are two computers that can be connected to intersvr through it to form a simple network, this is a very useful command, but it is not often used

[method] DOS adds the function of supporting network,
It can connect two computers through parallel port line or serial port line to form a simple network. The use of INTERLNK must be in config Add a sentence to sys:
Both ends of the parallel port line shall be 25 pin male connectors, and the connection between the pins is shown in the figure below:
P5 ————————– P10 male connector refers to the connector with pin
P6 ————————– P11 female connector refers to the connector with hole
P25 ————————— P25 ground wire

[example] C: \ DOS \ > INTERLNK port-lpt1

        this Computer    Other Computer

         (Client)       (Server)


            E:   equals   A:

            F:   equals   C:

In the client, disk e is disk a of the server, and disk f is Disk C of the server

Intersvr start simple web server

[applicable occasions] using it, the computer becomes a server (only with the simple network provided by DOS)

[method] intersvr starts the service machine

Intersvr / LPT: 1 start the server and use LPT1 port as the data transmission port

Intersvr / COM: 1 start the service machine and use COM1 port as the data transmission port

Parameters also include x baud: b v rcopy (see INTERLNK)

[example] C: \ DOS > intersvr??

QBASIC start basic integrated environment

[suggestion] Maybe most people will never use it

If you know QBASIC language, you can use it to write your own program. edit. Com must have it to be available.

QBASIC starting basic language environment

QBASIC / editor edits the language in full screen mode

Parameters: B G H MBF nohi run

[example] C: \ DOS > QBASIC??
Setver set version

[application] when you want to use other versions of DOS commands, you can use it to deceive the computer. In higher version DOS, some old version programs need dos3 3, setver can be used to set

[usage] it is generally used in config Add device = setver. Into sys exe

Setver displays the version of the file

Setver [file name] n.nn sets the version number of the specified file

[example] C: \ DOS > setver??
        KERNEL.EXE 5.00
        DOSOAD.SYS 5.00
        EDLIN.EXE 5.00
        BACKUP.EXE 5.00
        ASSIGN.COM 5.00
        EXE2BIN.EXE 5.00
        JOIN.EXE 5.00
        RECOVER.EXE 5.00
        WINWORD.EXE 4.10

If procedure AAA Exe must be in ms-dos3 3, type

        C:\DOS>setver aaa.exe 3.30??

Another example is net5 Exe is only available in ms-dos5 0, in config Add device = setver. Into sys Exe can also be found in ms-dos6 Run at 22.

Share file share

[suggestion] it is only used when the software declares that it must run it

[usage] can be found in config Add install = share in sys Exe can also be run directly. The parameters are f L

Subst Path replacement

[suggestion] a very interesting command may be useful if you often use CD-ROM software.

[method] subst displays the current alternative path

Subst [drive letter] [path]
Replaces the drive letter with the specified path, which will be used as a drive

Subst / b unsubstitute

[example] C: \ DOS > subst A: C: \ temp?? Replace disk a with Disk C temp directory

C:\>subst a: /d? Case report? replace

Tree displays the command tree structure

[where applicable] view all subdirectories

Tree [drive letter] displays all subdirectory trees

Tree / F displays the directory with the file name

Tree / a displays the directory tree in ASCII

[example] C: \ windows > tree / a??

Unformat recover formatted disk

[suggestion] have you formatted the floppy disk with important information? Use unformat… What? If you use format / u, you’re dead

Unformat [drive letter] restores the specified formatted disk

Unformat / L displays the file name found by unformat

[example] C: \ windows > unformat A:??

Vsafe virus protection program

[suggestion] loading it into memory can detect many kinds of viruses at any time, which is more useful.

Vsafe load vsafe in memory

Vsafe / u remove vsafe from memory

Vsafe / NE load vsafe into extended memory

Vsafe / NX load vsafe into extended memory

Parameters also include ax CX n D

[example] C: \ > vsafe


Display DOS version

[example] C: \ > ver

       ??MS-DOS Version 6.22


Vol displays the specified disk volume label

[example] C: \ > Vol??

        Volume in drive C is Wang

        Volume Serial Number is 2116-1DD0


CTTY change control equipment

[suggestion] for the I / O device used to change the control, you can try this command, but I’m afraid it won’t work. It’s one of the most useless commands in DOS

[method] CTTY [device name] set the console

[example] C: \ > CTTY aux?? Set aux as input / output device.

Are you dazzled by the introduction of so many commands? The key to learning DOS is to practice more commands, but I have to remind you that you should be careful with some commands, or it will be too late to repent.

del *.* Delete all files in the current directory

[suggestion] use del *. In the root directory of disk C* It will make the computer unable to find the mouse, optical drive, use windows, or even start. In fact, using this command in any directory requires careful consideration.

deltree *.* Delete all directories and files in the current directory

[suggestion] if you use this command in the root directory of Disk C, you must ensure that your mind is clear and that it is necessary, but we don’t think you should use this command under any circumstances. Use deltree *. In any directory* Will be generated with del ** The same or even worse result. Be careful! Be careful!

Format C: / u format disk C

[suggestion] unless your hard disk is deeply infected by the virus, or a real computer expert tells you to do so, don’t format the C disk. It will cause you to lose all information and take several hours to reinstall all the software.

Fdisk hard disk partition

[suggestion] when partitioning the hard disk, you must let someone who has used this command to help you use it, otherwise you will lose all information and even the hard disk can’t be used.

Recover overwrite disk

[suggestion] this command will no longer exist after DOS 6. If you use the old version of DOS, you are advised not to use it at any time. It has no other function except to destroy all the information of your hard disk.