Displays or sets the search path for data files. DOS will search the specified path(s) if the file is not found in the current path.
example echo Entry added on March 13, 2024. >> log.txt "echo" is a command that prints its argument to the standard output, which, by default, is the command line window. ">>" is the append redirection operator. It redirects the output of the command on its left (the echo command in this case) to the file on its right. Crucially, if the file already exists, >> ensures that the new data is added at the end of the existing file, rather than overwriting it. "log.txt" is the target file to which the output from echo is being app
Displays or modifies file name extension associations.
example >assoc .txt This command might return something like: >.txt=txtfile This output means that files with the .txt extension are associated with the "txtfile" file type, which is typically handled by a text editor like Notepad in Windows. >assoc/? output: ASSOC [.ext[=[fileType]]] .ext Specifies the file extension to associate the file type with. fileType Specifies the file type to associate with the file extension.
Sets or displays the read-only, archive, system, and hidden attributes of a file or directory.
example If you want to make example.txt read-only to prevent modifications, you would use: >attrib +R example.txt This command adds the Read-only attribute to the file. To remove the Read-only attribute later, you would use: >attrib -R example.txt >attrib/? output: ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] [+I | -I] [drive:][path][filename] [/S [/D] [/L]] + Sets an attribute. - Clears an attribute. R Read-only file attribute. A Archive file attribute. S System file attribute. H Hidden file attribute. I Not content indexed file attribute. [drive:][path][filename] Specifies a file or files for attrib to process. /S Processes matching files in the current folder and all subfolders. /D Processes folders as well. /L Work on the attributes of the Symbolic Link versus the target of the Symbolic Link
Used from the DOS prompt or in a batch file or in the CONFIG.SYS file to set (or display) whether or not DOS should check for a Ctrl + Break key combination.
example inside of example.bat: @echo off break off :start echo This is a simple example script. timeout /t 1 >nul goto start *run the script example.bat on cmd To enable interruption: > break on To disable interruption: > break off By default, the BREAK status is usually ON, allowing the user to interrupt batch scripts using CTRL+C. When BREAK is turned OFF, the CTRL+C interruption is disabled, and the script continues running without being interrupted.
Starts a batch file from within another batch file and returns when that one ends.
example Let's say you have two batch scripts: first_script.bat: This script will call the second script and then display a message. second_script.bat: This script will simply display a message. inside first_script.bat: @echo off echo This is the first script. echo Now, calling the second script... call second_script.bat echo Back to the first script. pause inside second_script.bat: @echo off echo This is the second script. *save it on same directory and run the first_script.bat output: > This is the first script. Now, calling the second script... This is the second script. Back to the first script. Press any key to continue . . .
The CHDIR (or the alternative name CD) command either displays or changes the current working directory.
example >cd C:\Programs\Python cd is the command used to change directories. C:\Programs\Python is the path to the directory you want to navigate to. When you execute this command, the current working directory changes to C:\Programs\Python.
Displays the current code page or changes the code page that DOS will use.
example >CHCP >Active code page: 437 When you run CHCP without any arguments, it displays the current active code page. In the example above, the output Active code page: 437 indicates that the current active code page is 437.
Checks a disk and provides a file and memory status report.
example >chkdsk C: The chkdsk command is used in Windows to check the file system and file system metadata of a disk volume for errors, and to fix any issues found. >chkdsk/? CHKDSK [volume[[path]filename]] [/F] [/V] [/R] [/X] [/I] [/C] [/L[:size]] [/B] [/scan] [/spotfix] volume Specifies the drive letter (followed by a colon), mount point, or volume name. filename FAT/FAT32 only: Specifies the files to check for fragmentation. /F Fixes errors on the disk. /V On FAT/FAT32: Displays the full path and name of every file on the disk. On NTFS: Displays cleanup messages if any. /R Locates bad sectors and recovers readable information (implies /F). /L:size NTFS only: Changes the log file size to the specified number of kilobytes. If size is not specified, displays current size. /X Forces the volume to dismount first if necessary. All opened handles to the volume would then be invalid (implies /F). /I NTFS only: Performs a less vigorous check of index entries. /C NTFS only: Skips checking of cycles within the folder structure. /B NTFS only: Re-evaluates bad clusters on the volume (implies /R) /scan NTFS only: Runs an online scan on the volume /forceofflinefix NTFS only: (Must be used with "/scan") Bypass all online repair; all defects found are queued for offline repair (i.e., "chkdsk /spotfix"). /perf NTFS only: (Must be used with "/scan") Uses more system resources to complete a scan as fast as possible. This may have a negative performance impact on other tasks running on the system. /spotfix NTFS only: Runs spot fixing on the volume /sdcleanup NTFS only: Garbage collect unneeded security descriptor data (implies /F). The /I or /C switch reduces the amount of time required to run CHKDSK by skipping certain checks of the volume.
The chkntfs command displays or modifies the checking of the disk drive using NTFS at boot time.
example >chkntfs C: This specifies the drive letter (in this case, drive C) for which you want to check the disk during boot. >chkntfs/? CHKNTFS volume [...] CHKNTFS /D CHKNTFS /T[:time] CHKNTFS /X volume [...] CHKNTFS /C volume [...] volume Specifies the drive letter (followed by a colon), mount point, or volume name. /D Restores the machine to the default behavior; all drives are checked at boot time and are not skipped. /T[:time] Changes the Autochk.exe initiation countdown time to the value specified in seconds. If time is not specified, displays the current setting. /X Excludes a drive from the default boot-time check. Excluded drives are not accumulated between command invocations. /C Schedules a drive to be checked at boot time; chkdsk will run if the drive is dirty.
The CLS or CLRSCR command clears the terminal screen.
example >CLS It clears the screen by removing all text and resetting the command prompt to the top of the window.
Start a new instance of the command interpreter..
example >echo Hello, World! echo: This is a command used to display text on the command prompt. Hello, World!: This is the text that will be displayed on the command prompt. >cmd/? Starts a new instance of the Windows command interpreter CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF] [[/S] [/C | /K] string] /C Carries out the command specified by string and then terminates /K Carries out the command specified by string but remains /S Modifies the treatment of string after /C or /K (see below) /Q Turns echo off /D Disable execution of AutoRun commands from registry (see below) /A Causes the output of internal commands to a pipe or file to be ANSI /U Causes the output of internal commands to a pipe or file to be Unicode /T:fg Sets the foreground/background colors (see COLOR /? for more info) /E:ON Enable command extensions (see below) /E:OFF Disable command extensions (see below) /F:ON Enable file and directory name completion characters (see below) /F:OFF Disable file and directory name completion characters (see below) /V:ON Enable delayed environment variable expansion using ! as the delimiter. For example, /V:ON would allow !var! to expand the variable var at execution time. The var syntax expands variables at input time, which is quite a different thing when inside of a FOR loop. /V:OFF Disable delayed environment expansion.
Show differences between any two files, or any two sets of files.
example >COMP file1.txt file2.txt If the contents of file1.txt and file2.txt are identical, the command will display a message indicating that the files are the same. If there are differences between the files, COMP will display the offset and line number where the first difference occurs. >comp/? Compares the contents of two files or sets of files. COMP [data1] [data2] [/D] [/A] [/L] [/N=number] [/C] data1 Specifies location and name(s) of first file(s) to compare. data2 Specifies location and name(s) of second files(s) to compare. /D Displays differences in decimal format. /A Displays differences in ASCII characters. /L Displays line numbers for differences. /N=number Compares only the first specified number of lines in each file. /C Disregards case of ASCII letters when comparing files.
Makes copies of existing files.
example >copy C:\Folder1\file1.txt D:\Folder2\file2.txt the command copies file1.txt from the directory C:\Folder1 to the directory D:\Folder2, renaming it to file2.txt in the process. >copy/? Copies one or more files to another location. COPY [/D] [/V] [/N] [/Y | /-Y] [/Z] [/A | /B ] source [/A | /B] [+ source [/A | /B] [+ ...]] [destination [/A | /B]] source Specifies the file or files to be copied. /A Indicates an ASCII text file. /B Indicates a binary file. /D Allow the destination file to be created decrypted destination Specifies the directory and/or filename for the new file(s). /V Verifies that new files are written correctly. /N Uses short filename, if available, when copying a file with a non-8dot3 name. /Y Suppresses prompting to confirm you want to overwrite an existing destination file. /-Y Causes prompting to confirm you want to overwrite an existing destination file. /Z Copies networked files in restartable mode.
Displays or sets the system date.
>date This command will display the current date in the system's format. example >date 03-13-2024 This command will set the system date to March 13, 2024.
DEBUG is a command-line debugging tool available in MS-DOS and Windows operating systems.
example To start the DEBUG command, type "debug" at the command prompt and press Enter. This will launch the DEBUG interface. The DEBUG interface consists of a command prompt where you can enter various commands to inspect and modify memory and files. Here is a simple example of using DEBUG to view the contents of a file: >debug example.txt This command opens the file "example.txt" in DEBUG mode, allowing you to view its contents as hexadecimal values. Once inside DEBUG, you can use various commands to interact with memory and files. For example, to display the contents of a specific memory location, you can use the "d" command followed by the memory address: >d 100 This command displays the contents of the memory address 100 in hexadecimal format. DEBUG provides a range of commands for debugging and editing purposes, making it a powerful tool for low-level system analysis and troubleshooting.
DEFRAG is a command in Windows used to defragment disk volumes.
example >defrag C: This command defragments the disk volume specified (in this case, drive C:). Defragmentation is the process of reorganizing the data on a disk volume to optimize the way files are stored, making the system run more efficiently. >defrag/? DEFRAG volume [/A | /F] [/V] [/?] volume Specifies the drive letter (followed by a colon), mount point, or volume name. /A Analyzes the specified volume, but does not defragment it. /F Forces defragmentation of the volume, even if it's not needed. /V Displays the complete analysis and defragmentation reports. /? Displays help at the command prompt.
Deletes one or more files.
example >del file.txt The del command is used to delete a single file named "file.txt" from the current directory. >del folder\*.* This command will delete all files in the "folder" directory and its subdirectories, but it will not delete the folder itself. >del /s folder This command will delete the "folder" directory and all its contents, including subdirectories. >del /p file.txt The /p option prompts you to confirm each file deletion. >del *.txt This command will delete all files with the .txt extension in the current directory. >erase file.txt The erase command is essentially the same as the del command. It is used to delete a single file named "file.txt" from the current directory. Both del and erase commands perform the same function of deleting files, and they can be used interchangeably.
Deletes a directory and all the subdirectories and files in it.
example >DELTREE C:\FolderToDelete This command will delete the directory "FolderToDelete" located on drive C: and all its contents.
Displays a list of files and subdirectories in a directory.
example >DIR C:\Windows\System32 This command will list all files and subdirectories in the "System32" directory located on drive C: under the "Windows" directory.
Compares the contents of two floppy disks or hard disks.
example >DISKCOMP A: B: This command will compare the contents of the floppy disks inserted in drives A: and B:.
Copies the entire contents of one floppy disk to another.
example >DISKCOPY A: B: This command will copy the entire contents of the floppy disk inserted in drive A: to another floppy disk inserted in drive B:.
Enables users to recall, edit, and create command lines, as well as to create macros.
example >DOSKEY /HISTORY This command will display the command history stored in DOSKEY, showing the previously executed commands.
Mounts, compresses, and manages DriveSpace compressed drives.
example >DRVSPACE /MOUNT C This command will mount the compressed drive C created using DriveSpace.
Displays messages, or turns command echoing on or off.
example >ECHO Hello, World! This command will display "Hello, World!" in the command prompt.
Starts the MS-DOS Editor, a text editor used to create and modify text files.
example >EDIT example.txt This command will open the MS-DOS Editor with the file "example.txt" for editing.
Starts the Edlin line-based text editor, used to create and modify text files.
example >EDLIN example.txt This command will open the Edlin text editor with the file "example.txt" for editing.
Converts an .EXE (executable) file into a binary format file.
example >EXE2BIN program.exe program.bin This command will convert the executable file "program.exe" into a binary file "program.bin".
Terminates the command interpreter.
example >exit This command will terminate the command prompt window.
Expands one or more compressed files.
example >expand file1.ex_ file1.exe This command will expand the compressed file file1.ex_ into file1.exe.
Provides quick access to help documentation.
example >fasthelp This command will display a brief overview of available commands and options.
Enables faster access to frequently used files and directories.
example >fastopen This command will display the current list of files and directories that have been added to the fastopen table.
Compares two files or sets of files and displays the differences between them.
example >fc file1.txt file2.txt This command will compare file1.txt and file2.txt and display the differences between them.
Manages disk partitions on a hard drive.
example >fdisk This command will start the FDISK utility, allowing you to create, delete, and manage disk partitions.
Searches for a specified text string in one or more files.
example >find "keyword" file.txt This command will search for the specified keyword in the file.txt and display the lines where it is found.
Searches for strings in files using regular expressions.
example >findstr /i "pattern" file.txt This command will search for the specified pattern in the file.txt, ignoring case, and display the lines where it is found.
Runs a specified command for each file in a set of files.
example >for %i in (*.txt) do echo %i This command will echo the name of each .txt file in the current directory.
Formats a disk for use with Windows.
example >format C: This command will format the C: drive, removing all data and preparing it for use with Windows.
Directs the command interpreter to a labeled line in a batch script.
example >goto label This command will transfer control to the line labeled "label" in the current batch script.
Loads a program that provides graphics capabilities.
example >graphics This command will load a graphics program, enabling graphical interface capabilities.
Provides information about Windows commands and their usage.
example >help This command will display a list of available commands and brief descriptions of their functions.
Performs conditional processing in batch files.
example >if %errorlevel% == 0 ( echo Command executed successfully ) else ( echo An error occurred ) This command will check the error level and display different messages based on its value.
Starts the Interix server, which provides UNIX-like functionality on Windows.
example >intersvr This command will start the Interix server, enabling UNIX-like functionality on the Windows operating system.
Establishes a connection with another computer using a parallel or serial cable.
example >interlnk /M This command enables the INTERLNK server, allowing connection using a serial cable (/M parameter).
Changes the keyboard layout.
example >keyb uk This command changes the keyboard layout to the United Kingdom layout (uk parameter).
Assigns a label to a disk.
example >label D: MyDisk This command assigns the label "MyDisk" to the disk drive D:.
Loads a program above the first 64K of memory.
example >loadfix program.exe This command loads the program "program.exe" into memory above the first 64K.
Loads a program into upper memory.
example >loadhigh program.exe This command loads the program "program.exe" into upper memory.
Creates a new directory.
example >mkdir new_directory This command creates a new directory named "new_directory".
Displays memory usage.
example >mem This command displays memory usage information.
Optimizes conventional memory usage.
example >memmaker This command launches the MemMaker utility to optimize conventional memory usage.
Configures system devices and switches.
example >mode COM1:9600,n,8,1 This command sets the configuration for COM1 serial port to 9600 baud rate, no parity, 8 data bits, and 1 stop bit.
Displays output one screen at a time.
example >more textfile.txt This command displays the contents of "textfile.txt" one screen at a time.
Moves one or more files from one directory to another.
example >move file.txt C:\destination This command moves the file "file.txt" to the directory "C:\destination".
Starts the Microsoft Antivirus application.
example >msav This command starts the Microsoft Antivirus application.
Installs the Microsoft CD-ROM Extensions.
example >mscdex /D:MSCD001 /L:D This command installs MSCDEX and assigns the drive letter D: to the CD-ROM drive.
Starts the Microsoft Diagnostics utility.
example >msd This command starts the Microsoft Diagnostics utility.
Displays or sets the command search path.
example >path This command will display the current command search path.
Pauses the processing of a batch file and displays the message "Press any key to continue..."
example >pause This command will pause the batch file execution and display the message "Press any key to continue...".
Tests the network connectivity with another host using ICMP Echo Request messages.
example >ping www.example.com This command will send ICMP Echo Request messages to www.example.com and display the round-trip time if successful.
Prints a text file to a specified printer.
example >print C:\Files\document.txt This command will print the document.txt file to the default printer.
Changes the command prompt text.
example >prompt $P$G This command will change the command prompt to display the current drive and directory followed by a greater than sign (>).
Starts the QBasic programming environment.
example >qbasic This command will launch the QBasic programming environment.
Removes a directory.
example >rmdir C:\Temp This command will remove the Temp directory located in the C drive.
Recovers readable information from a damaged disk.
example >recover D: This command will attempt to recover readable information from the D drive.
Records comments (remarks) in a batch file or CONFIG.SYS.
example >rem This is a comment This command will add a comment in a batch file or CONFIG.SYS, which will be ignored during execution.
Renames a file or directory.
example >ren oldfile.txt newfile.txt This command will rename the oldfile.txt to newfile.txt.
Replaces files.
example >replace C:\Files\file1.txt D:\Backup\file1.txt This command will replace the file1.txt in the Backup directory with the file1.txt from the Files directory.
Restores files that were backed up using the BACKUP command.
example >restore D:\Backup\file1.txt C:\Files\file1.txt This command will restore the file1.txt from the Backup directory to the Files directory.
Checks a disk and provides a file and memory status report.
example >scandisk C: The scandisk command is used in Windows to check the file system and file system metadata of a disk volume for errors, and to fix any issues found. >scandisk/? SCANDISK [drive:][path]filename [/p] [/surface] drive: Specifies the drive to check. filename Specifies the file to check. /p Checks the drive and displays a report, but does not fix any errors. /surface Checks the entire surface of the disk for bad sectors.
Selects or unselects one or more files.
example >select *.txt The select command is used in Windows to choose one or more files for further manipulation in a batch script or command line environment. >select/? SELECT [/S:drive] [/D:drive] [pathname...] /S:drive Searches the specified drive for files to select. /D:drive Clears the selection on the specified drive. pathname Specifies the file or directory to select.
Sets or displays environment variables.
example >set PATH=C:\Program Files;%PATH% The set command is used in Windows to set or display environment variables. In this example, it adds "C:\Program Files" to the PATH environment variable. >set/? SET [variable=[string]] variable Specifies the environment-variable name. string Specifies a series of characters to assign to the variable.
Launches the Windows Setup program to install or configure Windows.
example >setup This command will launch the Windows Setup program, allowing you to install or configure Windows.
Sets the version number that MS-DOS reports to a program.
example >setver myprog.exe 6.22 This command will set the version number reported to the program "myprog.exe" to 6.22.
Installs support for file sharing and locking capabilities.
example >share This command will install support for file sharing and locking capabilities.
Shifts the position of replaceable parameters in batch files.
example >shift This command will shift the position of replaceable parameters in a batch file.
Displays information about the amount of free and used memory on a disk.
example >sizer C: This command will display information about the amount of free and used memory on the disk C:.
Installs and configures SmartDrive, a disk caching utility.
example >smartdrv /X This command will install and configure SmartDrive, with extended caching enabled.
Sorts the input and sends the result to the output.
example >sort file.txt This command will sort the contents of the file "file.txt" and display the result.
Associates a path with a drive letter.
example >subst X: C:\MyFolder This command will associate the path "C:\MyFolder" with the drive letter X:.
Copies system files to a disk so that it can be used to start a computer.
example >sys C: This command will copy system files to the disk specified by the drive letter C:.
Connects to a remote computer using the Telnet protocol.
example >telnet 192.168.1.1 This command will establish a Telnet connection to the remote computer with the IP address 192.168.1.1.
Displays or sets the system time.
To display the current time:
>time This command will display the current time in the system's format.
To set the system time:
example time 12:00:00 This command will set the system time to 12:00:00.
Sets the window title for the command prompt window.
example >title My Command Prompt This command will set the title of the command prompt window to "My Command Prompt".
Displays the folder structure of a directory in a tree-like format.
example >tree C:\Windows This command will display the folder structure of the C:\Windows directory.
Displays the true path of a specified file or folder.
example >truename myfile.txt This command will display the full path of the file "myfile.txt".
Displays the contents of a text file.
example >type myfile.txt This command will display the contents of the file "myfile.txt".
Restores files that were previously deleted from a disk.
example >undelete myfile.txt This command will attempt to restore the file "myfile.txt" that was previously deleted from the disk.
Attempts to recover data from a formatted disk.
example >unformat C: This command will attempt to recover data from the formatted disk "C:".
Displays the Windows version number.
example >ver This command will display the version number of the Windows operating system.
Specifies whether to verify that files are written correctly to a disk.
example >verify on This command will enable the file verification feature, ensuring that files are written correctly to the disk.
Displays the volume label and serial number of a disk.
example >vol C: This command will display the volume label and serial number of the disk "C:".
Starts the McAfee VirusScan for DOS utility to protect your system from viruses.
example >vsafe /s /p This command will start the McAfee VirusScan for DOS utility in silent mode (/s) and prompt (/p) for user actions if a virus is found.
Copies files and directory trees.
example >xcopy C:\Source\*.* D:\Destination /s /e This command will copy all files and subdirectories from the source directory (C:\Source) to the destination directory (D:\Destination), including empty directories (/s) and subdirectories (/e).