List of MS-Dos Commands

 

List of MS-Dos Commands

Here's a table of some of the essential and commonly used commands MS-Dos for Commands for quick reference:

Command

Syntax

Description

CD

CD [drive:][path]Change

ges the current directory to the specified folder.

DIR

DIR [drive:][path]

Displays a list of files and subdirectories in a directory.

COPY

COPY [source] [destination]

Copies files from one location to another.

DEL

DEL [drive:][path]

Deletes one or more files.

REN

REN [drive:][path][filename1] [filename2]

Renames a file or directory.

MKDIR

MKDIR [drive:][path]

Creates a new directory.

RMDIR

RMDIR [drive:][path]

Removes an existing directory.

TYPE

TYPE [drive:][path]

filename Displays the contents of a text file.

EDIT

EDIT [drive:][path]filename

Opens the MS-DOS text editor for editing a specified file.

CHKDSK

CHKDSK [volume:][[path]filename] [/F] [/V] [/R] [/X] [/I] [/C] [/L[:size]] [/B]

Scans and fixes errors on a disk.

FORMAT


FORMAT volume [/FS:file-system] [/V:label] [/Q] [/L[:size]] [/A:size] [/C] [/X]

Prepares a storage medium for data storage.

XCOPY

XCOPY [source] [destination] [/E] [/C] [/H] [/R] [/Y]

Copies files and directories, including subdirectories.

TREE

TREE [drive:][path]

Graphically displays the folder structure of a drive or path.

DATE

DATE [MM-DD-YYYY]

Displays or sets the system date.

TIME

TIME [HH: MM: SS]

Displays or sets the system time.

HELP

HELP [command]

Provides help information for MS-DOS commands.

EXIT

EXIT

Exits the MS-DOS command prompt or a batch file.

ATTRIB


ATTRIB [+ R|-R] [+A|-A] [+ H|-H] [+ S|-S] [d:][path]filename [/S]

Sets or clears file attributes (Read-Only, Archive, System, Hidden), managing file visibility and access in MS-DOS.

MODE

MODE [device] [BAUD=b] [PARITY=p] [DATA=d] [STOP=s]

Configures system devices.

DISKCOPY

DISKCOPY [drive1:][path1][filename1] [drive2:][path2][filename2]

Copies the contents of one disk to another.

MEM

MEM[/program|/debug|/classify|/free|/module(name)] [/page]

Displays the amount of used and free memory in the system.

SCANDISK

SCANDISK [/SURFACE] [/AUTOFIX] [/CHECKONLY]

Scans and fixes disk errors.

UNDELETE

UNDELETE [drive:][path][filename]

Restores a deleted file.

ASSIGN

ASSIGN [drive1:=[drive2:]]

Redirects requests for drive letters to a different drive.

FDISK

FDISK

Manages disk partitions.

BACKUP

BACKUP [source] [destination] [/S]

Backs up files and directories.

RESTORE

RESTORE [source] [destination] [/S]

Restores files and directories from a backup.

MSCDEX

MSCDEX [/D: driver /L:drive] [/M:bufsize] [/E /S /V]

Provides CD-ROM access.

SYS

SYS [drive1:][path]

Transfers system files to a disk.

SHARE

SHARE [/F:(space)] [/L:(locks)]

Installs file-sharing and locking capabilities.

SMARTDRV

SMARTDRV [size] [/E /V] [/C] [/L:size]

Disk caching utility.

SETVER

SETVER [drive:][path]filename [/B:bytes]

Sets the MS-DOS version number for a program.

ASSIGN

ASSIGN [/D]

Disables automatic drive-letter assignments.

FASTHELP

FASTHELP [command] [command] /?

Provides a quick overview of MS-DOS commands.

FC

FC [/A] [/C] [/L] [/LBn] [/N] [/OFF[LINE]] [/T]

Compares two files or sets of files and displays the differences between them.

FIND

FIND [/V] [/C] [/N] [/I] [/OFF[LINE]] "string" [[drive:][path]filename[ ...]]

Searches for a text string in files.

MORE

MORE [filename]

Display the content of a text file one screen at a time

ECHO


ECHO [on/off]

This command can either show or hide the text of the commands you type. Command echoing is on by default

ECHO

ECHO [<message>]

Specifies the text to display on the screen.

PATH

PATH [[drive:][path] [;...]]

Displays or sets a search path for executable files.

SET

SET [variable=[string]]

Sets or displays environment variables.

VOL

VOL [drive:]

Displays a disk label and serial number.

SUBST

SUBST [drive1: [drive2:]path]

Associates a path with a drive letter.

EDLIN

EDLIN [drive:][path][filename]

Edits text files.

DEBUG


DEBUG [drive:][path][filename]

Starts the Debug program for testing and debugging assembly-language programs.

HIMEM.SYS

HIMEM.SYS [/TESTMEM:off] [/HMAMIN=amount]

Provides upper memory block (UMB) and high memory area (HMA) support.

UNFORMAT

UNFORMAT [drive:][path]

Restores a formatted disk.

GRAPHICS

GRAPHICS [type] [[drive:][path]filename] [/R] [/B] [/LCD][/PRINTBOX:STD|/PRINTBOX:LCD]

Enables output of graphical screen content to print

QBASIC

QBASIC [drive:][path]

Starts the MS-DOS-based application for creating and running BASIC programs.

KEYB

KEYB [/CODEPAGE=page[,country]] [/E]

Configures a keyboard for a specific language.

CHOICE

CHOICE [/C:choices] [/N] [/S] [/T:c,nn]

Provides a prompt with a list of choices.

DISKCOMP

DISKCOMP [drive1:][drive2:]

Compares the contents of two floppy disks.

PRINT

PRINT [/D:device] [filename]

Sends a text file to a printer.

SORT

SORT [drive:][path][filename]

Sorts the contents of a text file.

APPEND

APPEND [[drive:]path[;...]]

Sets or displays the search path for data files.

ASSOC

ASSOC [.ext[=[fileType]]]

Associates file extension with a file type.

LABEL


LABEL [drive:][label]

Creates, changes, or deletes the volume label of a disk.

RECOVER

RECOVER [drive:][path][filename]

Recovers readable information from a bad or defective disk.

FASTOPEN

FASTOPEN [/X] [drive:] [path] [/R]

Speeds up the opening of files.

GOTO

GOTO <label>

Directs the command interpreter to a labeled line in a batch program.

SHIFT

SHIFT [/n <N>]

Shifts the position of batch parameters in a batch file.

JOIN

JOIN path [drive:]

Joins a drive letter and directory path.

SMARTDRV

SMARTDRV [size] [buffers] [doublebuffer] [/E] [/C] [/L] [/V] [/B]

Manages and optimizes disk caching.

BATCH

BATCH [filename]

Executes the commands specified in a batch file.

CALL

CALL [drive:][path]filename [batch-parameters]

Calls one batch program from another.

XCOPY source [destination] 

 source       指定要複製的檔案。  destination  指定新檔案的位置和/或名稱。
 /A           只複製已設定封存屬性的檔案,
              不會變更屬性。
 /M           只複製已設定封存屬性的檔案,
              會關閉封存屬性。
 /D:m-d-y     複製指定日期當天或之後變更的檔案。
              如果沒有提供日期,則只會複製
              其來源時間比目的地時間還新的檔案。
 /EXCLUDE:file1[+file2][+file3]...
              指定包含字串的檔案清單。每個字串
              在檔案中應各列一行。當字串中的任一字串
              符合要複製之檔案的絕對路徑的任一部分時
              ,將排除複製該檔案。例
              如,指定字串 (例如 \obj\ 或 .obj) 將分別排除
              目錄 obj 下的所有檔案,或個別具有 .obj 副檔名
              的所有檔案。
 /P           會先提示您,再建立每個目的地檔案。
 /S           複製目錄和子目錄 (空白目錄除外)。
 /E           複製目錄和子目錄 (包括空白目錄)。
              /S /E 也相同。可用來修改 /T。
 /V           確認每個新檔案的大小。
 /W           提示您先按下按鍵,再複製。
 /C           即使發生錯誤,仍繼續複製。
 /I           如果目的地不存在且複製一個以上檔案,
              則假設目的地必須為目錄。
 /-I          如果目的地不存在且複製單一指定檔案,
              則假設目的地必須為檔案。
 /Q           複製時不顯示檔案名稱。
 /F           複製時顯示完整的來源和目的地檔案名稱。
 /L           顯示要複製的檔案。
 /G           允許將加密檔案複製到不支援
              加密的目的地。
 /H           也複製隱藏及系統檔案。
 /R           覆寫唯讀檔案。
 /T           建立目錄結構,但不複製檔案。不
              包含空白目錄或子目錄。/T/E 包含
              空白目錄和子目錄。
 /U           只複製目的地中已存在的檔案。
 /K           複製屬性。一般 Xcopy 會重設唯讀屬性。
 /N           使用產生的簡短名稱複製。
 /O           複製檔案擁有權和 ACL 資訊。
 /X           複製檔案稽核設定 (意指 /O)。
 /Y           抑制提示以確認您想要覆寫
              現有的目的地檔案。
 /-Y          導致提示以確認您想要覆寫
              現有的目的地檔案。
 /Z           以可重新啟動模式複製網路檔案。
 /B           複製符號連結本身對比連結的目標。
 /J           使用未緩衝 I/O 複製。建議用於非常大的檔案。
 /COMPRESS    在檔案傳輸期間,如若適用,要求
              網路壓縮。
 /SPARSE      複製疏鬆檔案時保留疏鬆狀態。

留言