![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-09-22 08:07 |
47,812 topics / 349,917 posts / today 0 new / 48,271 members |
| DOS学习入门 & 精彩文章 (教学室) » 20 Ways to Use DOS Commands [Repost] |
| Printable Version 9,247 / 16 |
| Floor1 ko20010214 | Posted 2003-06-10 00:00 |
| 版主 Posts 1,628 Credits 7,296 | |
|
20 Ways to Use DOS Commands, from Feiye Net
There are about a hundred DOS commands in total (including text editing, virus scanning/removal, configuration files, batch processing, etc.). Here we will introduce twenty commonly used DOS commands in detail. First, let’s introduce the concept of wildcards. Wildcards * and ? * represents a string ? represents only one character Note that wildcards can only be used for the filename or the extension, not both together. For example, if we want to find all files starting with the letter y, we can enter the following command: dir y*.*; if we want to find all files with the extension exe, we can use dir .exe. ? represents only one character. For example, if I want to find all files whose second letter is s, I can enter: DIR ?s*.*. 1. dir dir is the abbreviation of the English word directory Displays files and subdirectory information in the specified disk and directory, including the volume label of the disk where the files and subdirectories are located, the names of files and subdirectories, the size of each file, the date and time the files and directories were created, as well as the number of files and subdirectories, the total number of bytes occupied, and the total remaining space on the disk. dir dir is one of the most commonly used DOS commands. The slash indicates that what follows is a parameter. The four most commonly used DOS parameters are the following: Parameter Meaning /p When the displayed information fills one screen, pause the display; press any key to display the next screen /o Display in sorted order. Different letters can follow o with different meanings /w Display only filenames and directory names, five filenames per line. That is, wide display /s Display all directories and files in the directory and its subdirectories /a Display hidden files Display the information inside the C:\WINDOWS\Desktop folder 2. md md is the abbreviation of the English make directory Create a subdirectory md path Use md to create a directory named purple 3. cd cd is the abbreviation of the English change directory Change or display the current directory cd Two kinds of paths can be used: absolute paths and relative paths. If there is only cd without parameters, it only displays the current path. Note: there must be two “special directories” in a subdirectory, namely “.” and “..”. One dot represents the current directory, and two dots represent the upper-level directory. From a simple and practical point of view, as long as we learn to go down one level at a time (cd directoryname of the next level), and go back out one level at a time (cd..), we can solve all problems. Of course, absolute paths can also be used. Enter the purple directory we just created 4. rd remove directory -- delete directory Delete an empty subdirectory rd path rd is a command specifically for deleting empty subdirectories. Note two things: first, it cannot delete a non-empty directory; second, it cannot delete the current directory. Use rd to delete the directory purple Next let’s use these three commands: md, cd, and rd. 5. copy copy means duplicate in English Copy one file or a group of files to the specified disk or directory copy filename.ext The basic usage of the file copy command is: “copy source filename target filename”. If only the target path is written without the target filename, it means copying under the same name; otherwise it is called renaming while copying. Note that when renaming while copying, generally do not change the file extension. To copy all files in the C:\purple directory to a floppy disk, you can enter the following command. Please note that the current drive and current path are different: C:\>copy purple A:\ If a file with the same name already exists on the target disk, the following prompt will appear: “Overwrite xxxx(Yes/No/All)”. At this time, reply Y to overwrite the current file, N to keep it, and A to overwrite all subsequent files without asking again. 6. del del is the abbreviation of the English delete Delete one file or a group of files in the specified disk and directory del filename.ext This command should be used carefully. Once deleted, it is not easy to recover. Wildcards can also be used to delete a class of files. When *.* is used, for safety a warning will be given, and deletion will proceed only after confirmation. If there is no message during the deletion process, it means it has been deleted correctly. Note that this command cannot delete files with read-only, hidden, or system attributes; if the specified file does not exist, the prompt “File not found” will appear; DOS can recover files deleted by mistake with the external command UNDELETE; it can only delete files, not directories. 7. ren ren is short for the English rename Change the name of one file or a group of files in the specified disk and directory ren filename1 filename2 The renaming operation is limited to the name of a certain file or group of files; it will not change the directory where the file is located. If wildcards are used, a batch of files will be renamed. 8. type Command to display the contents of a text file on the screen type filename.ext The type command is used to quickly and conveniently display the contents of a text file on the screen. Files with the extension TXT are text files. If this command is used to display files with extensions such as EXE or COM, the output is often a bunch of garbled symbols accompanied by irregular beeping sounds, and sometimes it may even cause a hang. 9. format Disk formatting format drive: Various disks manufactured by vendors can be used to store files for various operating systems. The disk formats of different operating systems are generally different and not interchangeable. The format command makes a new disk recognizable by the DOS operating system, so that it can store DOS files. The process of formatting a disk with this command is actually the process of organizing the disk using the information storage format specified by DOS. When formatting a disk, all existing data on the disk must be erased, a boot record written to the disk, a file allocation table and root directory divided out, and at the same time all bad sectors on the disk must be found and marked as unusable. We list only one command parameter here: /S. When this parameter is used, the disk is formatted and the operating system files are loaded, turning it into a boot disk. This is equivalent to running the next command SYS after format. 10. discopy diskcopy, translated into Chinese, means disk copy Copy a disk exactly identical to the original in content diskcopy source drive name target drive name Its main use is for backup. For example, when we first buy a computer, some device driver disks are usually included, and these drivers may be needed later. To prevent damage to these disks, you should make a backup set of them all. At that time, using the diskcopy command is relatively quick and convenient. 11. deltree Delete a directory tree DELTREE ] This command wipes out the entire specified directory tree, whether it is read-only, hidden, or not. It should be used with special care. It is a dangerous command. 12. mem mem is short for memory This command is used to see how much memory your computer has, as well as memory usage. Just type the mem command directly 13. chkdsk chkdsk is short for check disk. Used to check your disk usage. chkdsk disk name For example, to check usage on drive A, enter chkdsk A: ; to check usage on drive C, enter chkdsk C: ; if you directly enter chkdsk, it checks usage on the current disk. 14. sys System file transfer command. It transfers DOS’s two hidden system files IO.SYS and MSDOS.SYS to a specific location on the target disk, and copies the COMMAND.COM file there as well. When finished, the target disk becomes a DOS boot disk. SYS d2: Since these files need to be copied to specific locations, copying with the COPY command may not necessarily boot the machine. With the SYS command, DOS can move files that already occupy specific positions on the target disk, and copy the system files into the corresponding positions. The parameter C1ath is used to indicate the directory where the system files are located. If it is not specified, the default is the current directory of the current disk. Therefore this command should generally be run in the root directory of the source disk. 15. path -- KO says: Thanks to tanglu_sd for pointing this out. The original text had pass. That was a mistake in the original! Set the directories where DOS looks for .COM, .EXE, and .BAT files path=path] or path 16. edit The edit command is a simple editing program. We often use it to edit some programs and batch files. 17. cls Clear the contents on the display screen, and move the DOS prompt to the upper-left corner of the screen. cls 18. time Display and set the DOS system time time ]] 19. date Display and set the DOS system date date 20. ver Display the version number of the DOS system currently running ver Command: Function: attrib…………set file attributes ctty …………change control device defrag…………disk defragmentation doskey…………call and create DOS macro commands debug …………program debugging command emm386…………expanded memory management fc …………file comparison fdisk …………hard disk partitioning lh/loadhigh …load a program into upper memory move …………move files, rename directories more …………paged display prompt…………set the prompt set …………set environment variables smartdrv………set disk accelerator setver…………set version subst …………path substitution vol …………display the specified disk volume label xcopy …………copy directories and files ================ KO says: I actually saw a DOS article in another place too, I’m touched... reposting it here. Hehe... |
|
| Floor2 wenxuejun | Posted 2003-06-10 00:00 |
| 初级用户 Posts 2 Credits 110 | |
|
Simply too convenient!!!!!!!
|
|
| Floor3 wenxuejun | Posted 2003-06-10 00:00 |
| 初级用户 Posts 2 Credits 110 | |
|
Is there more stuff?
|
|
| Floor4 tanglu_sd | Posted 2003-06-10 00:00 |
| 高级用户 Posts 271 Credits 948 From sd | |
|
15. It should be: path
|
|
| Floor5 tom662 | Posted 2003-06-11 00:00 |
| 初级用户 Posts 6 Credits 131 | |
|
Thanks for sharing
|
|
| Floor6 gwyx2003 | Posted 2003-06-13 00:00 |
| 初级用户 Posts 5 Credits 127 | |
|
Good
|
|
| Floor7 hongyu | Posted 2003-06-14 00:00 |
| 初级用户 Posts 2 Credits 110 | |
|
Thank you very much!
|
|
| Floor8 wht1 | Posted 2003-06-17 00:00 |
| 初级用户 Posts 1 Credits 105 | |
| Floor9 liuhingbo | Posted 2003-06-18 00:00 |
| 初级用户 Posts 3 Credits 115 | |
|
Great
|
|
| Floor10 沈洁 | Posted 2003-06-18 00:00 |
| 金牌会员 Posts 1,812 Credits 4,590 From 上海市 | |
|
Thanks!
|
|
| Floor11 我来也 | Posted 2003-06-19 00:00 |
| 初级用户 Posts 1 Credits 105 | |
|
Pretty good, I read it.
|
|
| Floor12 心剑 | Posted 2003-06-19 00:00 |
| 初级用户 Posts 7 Credits 131 | |
|
When testing copy. It’s best for the .txt file to be larger than 10 bytes
|
|
| Floor13 mgc8915 | Posted 2003-08-06 00:00 |
| 中级用户 Posts 48 Credits 386 | |
|
I had the best DOS lesson, thanks!
|
|
| Floor14 hongqing | Posted 2003-08-06 00:00 |
| 初级用户 Posts 1 Credits 106 | |
| Floor15 young1234 | Posted 2003-09-18 00:00 |
| 中级用户 Posts 62 Credits 333 | |
| 1 2 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |