MS-DOS or Microsoft Disk Operating System was a 16-bit command user interface operating system used between 1981 and 2000. Following are its features:
Command prompt is a command-line interpreter available in all Windows operating systems. It is not the same as MS-DOS but an emulator which can run almost all the commands of MS-DOS. Use the following command to get started with the Command Prompt (CMD):
There are two broad categories of DOS commands as follows:
E.g., DISKCOMP, DIR
Here is a list of all basic MS-DOS commands, along with their syntax and examples.
This command triggers events for MS-DOS to look over other directories during file editing. It gives the user a way to set the search path for the files.
Type: External
Syntax
APPEND Drive: \Path /X /E Path:on or off
Example
append c:\cards;c:\letters
This command displays/adds/modifies/removes the address resolution protocol information from all the devices.
Type: External
Syntax: The following syntax is available as taken from PowerShell
Displays current ARP entries by interrogating the current protocol data. If inet_addr is specified, the IP and Physical addresses for only the specified computer are displayed. If more than one network interface uses ARP, entries for each ARP table are displayed.
Adds the host and associates the Internet address inet_addr with the Physical address eth_addr. The Physical address is given as 6 hexadecimal bytes separated by hyphens. The entry is permanent.
If present, this specifies the Internet address of the interface whose address translation table should be modified. If not present, the first applicable interface will be used.
Example
This command assigns or routes a drive request to a different drive. An assign command with no switches cancels redirected drive assignments and returns them to their original drives.
Type: External
Syntax
ASSIGN Source = Target /status
Example
assign c: = b:
This command displays the association of a file related to each different extension available in the machine. Without any parameter, this command displays the current file association.
Type: Internal
Syntax
ASSOC [.ext[=[fileType]]]
Example
assoc .exe
It will display the file extension for a .exe file
This command allows the user to schedule a fixed time and date to execute a set of programs.
Type: External
Syntax
AT [\\computername] [ [id] [/DELETE] | /DELETE [/YES]]
Example
at 7:00AM "c:\morning.bat"
This will execute morning.bat file at 7:00AM.
Deprecated
This command is now deprecated and now replaced with `schtasks.exe`. If it is run without any parameter, it will show all the scheduled tasks for the future time.
Example
This command allows the user to change the attributes of files. With the help of this command, the user can easily hide/display or do any other change in a file.
Type: External
Syntax
ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] [+O | -O] [+I | -I] [+X | -X] [+P | -P] [+U | -U] [drive:][path][file name] [/S [/D]] [/L]
SMR Blob attribute.
Work on the attributes of the Symbolic Link versus the target of the Symbolic Link.
Example
Here when we first typed the attrib command, it displayed the A attribute of file.txt. A means archive.
Afterward, we set the read-only attribute to the file and hit the attrib command again. Now it displays A and R
This command enables/disables the keyboard shortcuts for copying and pasting in the command prompt. In other words, Ctrl + C and Ctrl + V.
Type: Internal
Syntax
BREAK [ON | OFF]
Example
It enables the ctrl + C function.
Boot Configuration Datastore Editor. This command modifies the boot configuration data store. It also contains information that is required by the system to boot up.
Type: External
Syntax
bcdedit
Example
The content is directly taken from Powershell.
Following are the commands that operate on a store.
Exports the contents of the system store to a file. This file can be used later to restore the state of the system store.
Following are the commands that operate on entries in a store:
/copy | Makes copies of entries in the store. |
/create | Creates new entries in the store. |
/delete | Deletes entries from the store. |
/mirror | Creates mirror of entries in the store. |
This command is part of the recovery console and cannot be run directly. It helps users to do editing in the boot.ini file.
Type: Recovery
Syntax
BOOTCFG /parameter [arguments]
/parameter can include the following:
/copy | Makes a copy of an existing boot entry. |
/delete | Deletes an existing boot entry from the BOOT.INI file. |
/query | Displays the current boot entries and their settings. |
/raw | Allows the user to specify any switch to be added. |
/timeout | Allows the user to change the Timeout value. |
/default | Allows the user to change the Default boot entry. |
/EMS | Allows the user to configure the /redirect switch for headless support. |
/debug | Allows the user to specify the port for remote debugging. |
/addsw | Allows the user to add predefined switches. |
/rmsw | Allows the user to remove predefined switches. |
/dbg1394 | Allows the user to configure 1394 port for debugging. |
/? | Display a summary of parameters |
Example
BOOTCFG /Copy /D "Edit" /ID 8
This command means
/copy | This command makes a copy of the existing boot entry. |
/D | The description that has to be provided. |
/ID | It specifies the ID to be copied in the boot.ini. |
10. call
This command is used to run a script from within another script. This command cannot be used outside any script or in DOS.
Type: Internal
Syntax
CALL [drive:][path]file name [batch-parameters]
Example
call techgeekbuzz.bat
This command will execute the batch file techgeekbuzz and this command can only be run from inside of another batch file. l
This command is the most used command of DOS. Its full form is C hange D irectory. It is used to browse inside any directory. This is shorthand for chdir command.
Type : Internal
Syntax
CD [/D] [drive:][path]
Example
cd | It displays the current directory. |
cd d:/ | It moves into D drive. |
cd .\techgeekbuzz | It will move inside the techgeekbuzz folder. |
cd.. | It will come out from the current folder. |
12. chcp
Before understanding what this command does, we must understand what is an active code page. An active code page is a page which contains character codes and their corresponding characters.
For example, Active code page 437, mostly used in India, contains character code 161 as “b”.
The chcp command helps the user by giving her the option to configure the active code page number. It can be further used to implement the international keyboard allowing DOS to be used in different languages.
Type: External
Syntax
CHCP [nnn]
nnn Specifies a code page number.
Example
This command is the same as the cd command. It is used to change the directory.
Type: Internal
Syntax
CHDIR[..]
Example
chdir windows - It will move to the windows directory (Given that the windows directory should be available in the current directory)
Most of the commands are the same as we use with cd. But as we can see, the last command chdir.. is not running
This command is an abbreviation of check disk. It is used to identify and resolve errors on the hard disk. It opens a utility that checks the hard disk for any errors.
Type: External
Syntax
CHKDSK [volume[[path]file name]]] [/F] [/V] [/R] [/X] [/I] [/C] [/L[:size]] [/B] [/scan] [/spotfix]
On FAT/FAT32: Displays the full path and name of every file on the disk.
NTFS only: Performs a less vigorous check of index entries.
NTFS only: (Must be used with "/scan") bypass all online repair; all defects found are queued for offline repair (i.e., "chkdsk /spotfix").
NTFS only: (Must be used with "/scan") uses more system resources to complete a scan as fast as possible. This option may have a negative performance impact on other tasks running on the system.
Example
This command is used by a user inside a batch file only. This provides a list of choices available to the user and also returns the index of the selected choice.
Type: External
Syntax
CHOICE [/C choices] [/N] [/CS] [/T timeout /D choice] [/M text]
Hides the list of choices in the prompt.
The message before the prompt is displayed and the choices are still enabled.
Specifies the default choice after nnnn seconds. The character must be in the set of choices specified by /C option and must also specify nnnn with /T.
Specifies the message to be displayed before the prompt. If not specified, the utility displays only a prompt.
Example
This command is used to copy the content to the clipboard. The copied item can further be pasted into other files.
Type: External
Syntax
CLIP < FILE.TXT
It places the content of file.txt onto the windows clipboard?
Example
It copies the current directory listing to the Windows clipboard.
This command clears the screen.
Type: Internal
Syntax
cls clear
Example
This command is used to compare two files present in a given directory.
Type: External
Syntax
COMP [data1] [data2] [/D] [/A] [/L] [/N=number] [/C] [/OFF[LINE]] [/M]
data1 | Specifies location and name(s) of first file(s) to compare. |
data2 | Specifies location and name(s) of second files 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. |
/OFF[LINE] | Do not skip files with offline attribute set. |
/M | Do not prompt for compare more files. |
Example
This command is used to compress files for utility purposes. It is also used to uncompress so that users can use it.
Type: External
Syntax
COMPACT [/C | /U] [/S[:dir]] [/A] [/I] [/F] [/Q] [/EXE[:algorithm]][/CompactOs[:option] [/WinDir:dir]] [filename [. ]]
Performs the specified operation on files in the given directory and all subdirectories. Default "dir" is the current directory.
Displays files with the hidden or system attributes. These files are omitted by default.
Use compression optimized for executable files which are read frequently and not modified. Supported algorithms are:
Set or query the system's compression state. Supported options are:
Example
This will compress the file.txt available in the directory.
This command is used to change the FAT volume to NTFS volume.
Type: External
Syntax
CONVERT volume /FS:NTFS [/V] [/CvtArea:filename] [/NoSecurity] [/X]
Specifies the drive letter (followed by a colon), mount point, or volume name.
Specifies that Convert will be run in verbose mode.
Specifies that the security settings on the converted files and directories allow access by all users.
Forces the volume to dismount first if necessary. All open handles to the volume will not be valid.
Example
convert d: /fs:ntfs
This command will convert the FAT volume D into NTFS volume.
This command is used to display or allow the user to change the current date.
Type: Internal
Syntax
date
Example
This command is used for defragmenting of drives.
Type: Internal
Syntax
Defrag []
Volumes:
Specifies the drive letter followed by a colon, mount point or volume name. More than one volume can be specified. Run all the given operations on each specified volume.
Operations:
On tiered volumes, optimize files to reside on the appropriate storage tier.
On thinly provisioned volumes, perform slab consolidation to increase slab usage efficiency.
Options:
Run the operation at normal priority (default is low).
Available only with TierOptimize. Tier optimization would run for at most n seconds on each volume.
Run the operation on each volume in parallel in the background. For TierOptimize, at most n threads optimize the storage tiers in parallel. Default value of n is 8. All other optimizations ignore n.
Example
This command is used to delete one or more files from the current directory.
del command is the same as erase command.
Type: Internal
Syntax
del filename
Example
In this example above, we have first looked into the available files in the current working directory.
After that, we run the del command to delete one file.
The following command shows that the file is deleted.
This command displays the content(which includes files and folders) of the directory we are currently in. It also displays the file's attributes like last updated, mode and size.
Type: Internal
Syntax
Example
This command is hardly used now. This command is to compare the content of two floppy disks. But as floppies are hardly used now, we will not go into the details of these commands.
Type: External.
Syntax
DISKCOMP [drive1: [drive2:]]
26. diskcopy
Similarly, this command is used to copy the content of one floppy to another.
Type: External.
Syntax
DISKCOPY [drive1: [drive2:]]
This command is used to edit command lines or use the commands the user has previously executed.
Type: External
Syntax
DOSKEY [/REINSTALL] [/LISTSIZE=size] [/MACROS[:ALL | :exename]][/HISTORY] [/INSERT | /OVERSTRIKE] [/EXENAME=exename] [/MACROFILE=filename][macroname=[text]]
/REINSTALL | Installs a new copy of Doskey. |
/LISTSIZE=size | Sets size of command history buffer. |
/MACROS | Displays all Doskey macros. |
/MACROS:ALL | Displays all Doskey macros for all executables which have Doskey macros. |
/MACROS: exename | Displays all Doskey macros for the given executable. |
/HISTORY | Displays all commands stored in memory. |
/INSERT | Specifies that new text you type is inserted in old text. |
/OVERSTRIKE | Specifies that new text overwrites old text. |
/EXENAME=exename | Specifies the executable. |
/MACROFILE=filename | Specifies a file of macros to install. |
macroname | Specifies a name for a macro you create. |
text | Specifies commands you want to record. |
Example
doskey /history
It will show the history of commands that have been run in the MSDOS.
This command displays the list of drivers installed in the system.
Type: External
Syntax
DRIVERQUERY [/S system [/U username [/P [password]]]][/FO format] [/NH] [/SI] [/V]
Parameter List:
Specifies the remote system to connect to.
Specifies the user context under which the command should execute.
Specifies the type of output to display. Valid values to be passed with the switch are "TABLE", "LIST", "CSV".
Specifies that the "Column Header" should not be displayed. Valid for "TABLE" and "CSV" format only.
Provides information about signed drivers.
Displays this help message.
Example
This command displays any, especially from a batch file.
Type: Internal
Syntax
echo “content”
Example
Here, we have first displayed a message.
In the next command, we have inserted a text into the intro.txt file.
This command is used to edit and view files.
Type: External
Syntax
EDIT [/B] [/H] [/R] [/S] [/] [/?] [FileName. ]
Load binary file(s), wrapping lines to characters wide.
Example
edit C:\techgeekbuzz\intro.txt
This command is used to close the command interpreter. There is no particular syntax for the same. Use the command exit to close the command prompt.
This command is used to compress the windows files and extract the files available in the CAB files.
Type: External
Syntax
EXPAND [-R] Source Destination
Source file specification. Wildcards may be used.
Example
expand d:\udd\file.dl_ c:\windows\system32\check.dll
This command explains the details of any other dos command.
Type: External
Syntax
FASTHELP [command]
Example
fasthelp cd
This command accepts two files and displays the difference in them. This can be used to compare two files with the help of DOS thoroughly.
Type: External
Syntax
FC [/A] [/C] [/L] [/LBn] [/N] [/OFF[LINE]] [/T] [/U] [/W] [/nnnn] [drive1:][path1]filename1 [drive2:][path2]filename2
Sets the maximum consecutive mismatches to the specified number of lines.
Do not skip files with offline attribute set.
Example
fc techgeekbuzzscript.bat techgeekbuzzbatch.bat
This command is used to search a text inside a given file. The set of files can be more than one.
Type: External
Syntax
FIND [/V] [/C] [/N] [/I] [/OFF[LINE]] "string" [[drive:][path]filename[ . ]]
/V | Displays all lines NOT containing the specified string. |
/C | Displays only the count of lines containing the string. |
/N | Displays line numbers with the displayed lines. |
/I | Ignores the case of characters when searching for the string. |
/OFF[LINE] | Do not skip files with offline attribute set. |
"string" | Specifies the text string to find. |
[drive:][path]filename | Specifies a file or files to search. |
Example
find /N "this" c:\techgeekbuzz\intro.txt
This command will display the line number of the selected text.
This command locates a file that contains the provided text. This is different from find as that searches for a text inside a file, and this searches for the file of that text.
Type: External
Syntax
FINDSTR [/B] [/E] [/L] [/R] [/S] [/I] [/X] [/V] [/N] [/M] [/O] [/P] [/F:file][/C:string] [/G:file] [/D:dir list] [/A:color attributes] [/OFF[LINE]] strings [[drive:][path]filename[ . ]]
Uses search strings literally.
Text to be searched for.
Example
findstr "this" *.txt
This command will print all the lines that contain the text “this” in all available text files.
This command is a variable that is used inside batch files to run specific commands.
Type: Internal
Syntax
FOR %variable IN (set) DO command [command-parameters]
%variable | An arbitrary parameter. |
(fileset) | Specifies a set of one or more files. Wildcards may be used. |
command | Specifies the command to carry out for each file. |
command-parameters | Specifies parameters or switches for the specified command. |
Example
for /F %%A in ("intro.txt") do If %%~zA equ 10 del intro.txt
The above command will execute over intro.txt. If the file is found in the current directory and the size is 10, it will be deleted.
This command is used to format a disk with windows
Type: External
Syntax
FORMAT volume [/FS:file-system] [/V:label] [/Q] [/L[:state]] [/A:size] [/C] [/I:state] [/X] [/P:passes] [/S:state]
volume | Specifies the drive letter (followed by a colon), mount point, or volume name. |
/FS:filesystem | Specifies the type of the file system (FAT, FAT32, exFAT, NTFS, UDF, ReFS). |
/V:label | Specifies the volume label. |
/Q | Performs a quick format. Note that this switch overrides /P. |
/C | NTFS only: Files created on the new volume will be compressed by default. |
/X | Forces the volume to dismount first if necessary. All opened handles to the volume would no longer be valid. |
/R:revision | UDF only: Forces the format to a specific UDF version(1.02, 1.50, 2.00, 2.01, 2.50). The default revision is 2.01. |
/D | UDF 2.50 only: Metadata will be duplicated. |
/L[:state] | NTFS Only: Overrides the default size of file record. By default, a non-tiered volume will be formatted with small size file records and a tiered volume will be formatted with large size file records. |
/L and /L | Enable forces format to use large size file records and /L:disable forces format to use small size file records. |
Example
FTP is a file transfer protocol. This command is used to transfer files to and from a computer running an FTP server service.
Type: External
Syntax
FTP [-v] [-d] [-i] [-n] [-g] [-s:filename] [-a] [-A] [-x:sendbuffer] [-r:recvbuffer] [-b:asyncbuffers] [-w:windowsize] [host]
Turns off interactive prompting during multiple file transfers.
Use any local interface when binding data connection.
Overrides the default async count of 3
Specifies the host name or IP address of the remote host to connect to.
Example
This command will enable the debugging for all the next commands.
This command moves a file to a specified location.
Type: Internal
Syntax
GOTO label
label Specifies a text string used in the batch program as a label.
Example
GOTO start
This command displays detailed information of any other command. If you type help in PowerShell, it will display help about PowerShell cmdlets and concepts. A more precise way to use this is with the shortcut “/?”
Type: External
Syntax
[Any command] /?
Example
This command is a conditional expression inside a batch file.
Type: Internal
Syntax
IF [NOT] ERRORLEVEL number command
NOT Specifies that Windows 2000 or XP should carry out the command only if the condition is false.
ERRORLEVEL number Specifies a true condition if the last program run returned an exit code equal to or greater than the number specified.
Example
IF EXIST intro.txt. ( del intro.txt. ) ELSE( echo intro.txt. missing. )
This command displays the network setting that includes the IP address associated with all ethernet adapters in the machine.
Type: External
Syntax
ipconfig [/allcompartments] [/? | /all | /renew [adapter] | /release [adapter] | /renew6 [adapter] | /release6 [adapter] | /flushdns | /displaydns | /registerdns | /showclassid adapter | /setclassid adapter [classid] | /showclassid6 adapter | /setclassid6 adapter [classid] ]
where,
adapter Connection name (wildcard characters * and ? allowed, see examples)
Options :
Release the IPv4 address for the specified adapter.
Modifies the IPv6 DHCP class id.
Example
This command is used to manage the label of existing drives in the machine. It can create, change or delete the label of a disk.
Type: External
Syntax
LABEL [drive:][label] LABEL [/MP] [volume] [label]
drive: | Specifies the drive letter of a drive. |
label | Specifies the label of the volume. |
/MP | Specifies that the volume should be treated as a mount point or volume name. |
volume | Specifies the drive letter (followed by a colon), mount point, or volume name. If volume name is specified, the /MP flag is unnecessary. |
Example
This command is used to terminate the current session.
Type: External
Syntax
LOGOFF [sessionname | sessionid] [/SERVER:servername] [/V] [/VM]
sessionname | The name of the session. |
sessionid | The ID of the session. |
/SERVER:servername | Specifies the Remote Desktop server containing the user session to log off (default is current). |
/V | Displays information about the actions performed. |
/VM | Logs off a session on server or within virtual machine. The unique ID of the session needs to be specified |
Example
logoff
This command is a recovery console command to enable administrator login.
Type: External
This is a recovery console command to display the device name of a drive.
Type : Internal
Syntax
map [arc]
arc is an option to provide information to map command about the device names.
This command is used to create a directory.
Type: Internal
Syntax
md [folder name]
Example
We see that a new folder name dosCheatSheet is created.
This command is used to configure system devices or display the settings of the machine.
Type: External
Syntax
Serial port: MODE COMm[:] [BAUD=b] [PARITY=p] [DATA=d] [STOP=s] [to=on|off] [xon=on|off] [odsr=on|off] [octs=on|off] [dtr=on|off|hs] [rts=on|off|hs|tg] [idsr=on|off]
MODE CON[:] [RATE=r DELAY=d]
Example
Typing just mode will print all the ports
This command is used to display the content of a file, one page at a time.
Type: External
Syntax
more [filename]
Example
This command is used to move a file from one directory to another.
Type: External
Syntax
MOVE [/Y | /-Y] [drive:][path]filename1[. ] destination
To rename a directory:
MOVE [/Y | /-Y] [drive:][path]dirname1 dirname2
Specifies the new location of the file. Destination can consist of a drive letter and colon, a directory name, or a combination. If you are moving only one file, you can also include a filename if you want to rename the file when you move it.
Example
As seen in the image above, we have moved the dos.txt from dosCheatSheet folder to techgeekbuzz
NBT stands for NETBIOS over TCP. This command is used to display protocol statistics and TCP connections.
Type: External
Syntax
NBTSTAT [ [-a RemoteName] [-A IP address] [-c] [-n][-r] [-R] [-RR] [-s] [-S] [interval] ]
Lists the remote machine's name table given its IP address.
Example
This command is used to update and fix the network settings.
Type: External
Syntax
NET [ ACCOUNTS | COMPUTER | CONFIG | CONTINUE | FILE | GROUP | HELP | HELPMSG | LOCALGROUP | PAUSE | SESSION | SHARE | START | STATISTICS | STOP | TIME | USE | USER | VIEW ]
Example
net send tgb "Hi"
This command will send “Hi” message to remote host named tgb.
This command is used to set dynamic and static network information.
Type: External
Syntax
Usage: C:\Windows\system32\netsh.exe [-a AliasFile] [-c Context] [-r RemoteMachine] [-u [DomainName\]UserName] [-p Password | *] [Command | -f ScriptFile]
Example
This command helps user to see network configuration.
This command helps the user to see the TCP/IP network protocol information.
Type: External
Syntax
NETSTAT [-a] [-b] [-e] [-f] [-i] [-n] [-o] [-p proto] [-r] [-s] [-t] [-x] [-y] [interval]
Displays the current connection offload state.
Example
This command is used to lookup an IP address on a network.
Type: External
Syntax
Usage: nslookup [-opt . ] nslookup [-opt . ] - server nslookup [-opt . ] host nslookup [-opt . ] host server
Example
This command is used to display or set the search path for any executable file.
Type: Internal
Syntax
PATH [[drive:]path[;. ][;%PATH%] PATH ;
Example
path=c:\windows\command
The command above would set the path to c:\windows\command. For all the future commands, this will be the executable path.
This command is used to suspend the processing of a batch command and display any message.
Type: Internal
This command is used to test and send information packets to another network.
Type: External
Syntax
Ping [hostaddress]
Example
This command is used to change to a directory stored by the PUSHD command.
Type: Internal
Syntax
popd [OPTIONS] [DIRECTORY]
This command is used to change the DOS prompt.
Type: Internal
Syntax
PROMPT [text]
[text] specifies a new command prompt
Example
prompt $t $d$_$p$g
Display the time and the date above your prompt when in DOS
This command is used to remove an empty directory.
Type: External
Syntax
RD [directory]
Example
This command is used to rename a directory or a file.
Type: External
Syntax
RENAME [drive:][path][directory name1 | file name1] [directory name2 | file name2] REN [drive:][path][directory name1 | file name1] [directory name2 | file name2]
Example
This command is used to remove an empty directory.
Type: External
Syntax
rmdir [directory]
Example
This command is used to manipulate network routing tables.
Type: External
Syntax
ROUTE [-f] [-p] [-4|-6] command [destination][MASK netmask] [gateway] [METRIC metric] [IF interface]
-f | Clears the routing tables of all gateway entries. If this is used in conjunction with one of the commands, the tables are cleared prior to running the command. |
-p | When used with the ADD command, makes a route persistent across boots of the system. By default, routes are not preserved when the system is restarted. Ignored for all other commands, which always affect the appropriate persistent routes. |
-4 | Force using IPv4. |
-6 | Force using IPv6. |
Example
This command enables a user to run a file as a different user.
Type: External
Syntax
RUNAS [ [/noprofile | /profile] [/env] [/savecred | /netonly] ] /user: program RUNAS [ [/noprofile | /profile] [/env] [/savecred] ] /smartcard [/user:] program RUNAS /trustlevel: program
Specifies that the user's profile should be loaded. This is the default.
To use current environment instead of user's.
Use if the credentials specified are for remote access only.
should be in form USER@DOMAIN or DOMAIN\USER.
Example
This command is used to communicate with the service manager.
Type: External
Syntax
sc [command] [service name] .
Example
sc delete abc.exe
This command is used to scan the hard drives.
Type: External
Syntax
scandisk [ drive: | volume_name | /all] [/checkonly | /autofix [/nosave] | /custom] [/fragment] [/surface] [/mono] [/nosave] [/nosummary]
Runs ScanDisk using the settings in the [custom] section of the scandisk.ini file. Cannot be used with /autofix or /checkonly.
This command is used to display, set, or remove cmd.exe environment variable.
Type: Internal
Syntax
SET [variable=[string]]
variable Specifies the environment-variable name.
string Specifies a series of characters to assign to the variable.
Example
This command is used to begin localization of environment changes in a batch file.
Type: Internal
Syntax
SETLOCAL
If Command Extensions are enabled SETLOCAL changes as follows:
SETLOCAL batch command now accepts optional arguments:
ENABLEEXTENSIONS / DISABLEEXTENSIONS : enable or disable command processor extensions. These arguments takes precedence over the CMD /E:ON or /E:OFF switches. See CMD /? for details.
ENABLEDELAYEDEXPANSION / DISABLEDELAYEDEXPANSION : enable or disable delayed environment variable expansion. These arguments takes precedence over the CMD /V:ON or /V:OFF switches. See CMD /? for details.
This command is used to change the position of replaceable parameters in a batch file.
Type: External
Syntax
SHIFT [/n]
This command is used to shut down the machine.
shutdown
This command is used to start a separate window to run a specified program.
Type: External
Syntax
START ["title"] [/D path] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED] [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL] [/NODE ] [/AFFINITY ] [/WAIT] [/B] [command/program] [parameters]
Start application in the BELOWNORMAL priority class.
Specifies the preferred Non-Uniform Memory Architecture (NUMA) node as a decimal integer.
Example
This command is used to associate a path to a drive letter.
Type: External
Syntax
SUBST [drive1: [drive2:]path] SUBST drive1: /D
drive1: Specifies a virtual drive to which you want to assign a path.
This command displays the time.
Example
This command is used to change the title of the DOS window.
Example
This command is used to display the contents of a text file or files.
Type: External
Syntax
TYPE [drive:][path]filename
Example
This command tells the version of the current operating system.
Example
This command is used to verify whether the files are written correctly on a disk or not.
Type: Internal
Syntax
VERIFY [ON | OFF]
Example
This command is used to display the disk volume label and its serial number.
Type: Internal
Syntax
Example
This command copies the file and directory.
Type: External
Syntax
XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W] [/C] [/I] [/Q] [/F] [/L] [/G] [/H] [/R] [/T] [/U] [/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z] [/B] [/J] [/EXCLUDE:file1[+file2][+file3]. ] [/COMPRESS]
Specifies the file(s) to copy.
Specifies a list of files containing strings. Each string should be in a separate line in the files. When any of the strings match any part of the absolute path of the file to be copied, that file will be excluded from being copied. For example, specifying a string like \obj\ or .obj will exclude all files underneath the directory obj or all files with the.obj extension respectively.
Prompts you to press a key before copying.
Displays files that would be copied.
Copies only files that already exist in destination
Suppresses prompting to confirm you want to overwrite an existing destination file.
Example
This command copies all the content of the current folder to the temp folder.
Most of the DOS commands mentioned above have a screenshot of their execution to help you out more effectively. Although we have tried to mention the syntax of each command, there exist some commands which don’t have any specific syntax. For example, time. Users can just write that command in the command prompt to execute it.
There are possibilities that the commands mentioned above will get updated with a new OS release. If you find any update or have any command in mind, which is essential and not mentioned in the article, then feel free to mention that in the comment below. Also, please comment below if you have any questions and find this article vague/helpful/excellent!
People are also reading
Paritosh Louhan
Paritosh is a developer by profession and a writer by heart. He is working with Nagarro as a Team Lead and loves to write in his free time. He believes that anything that couldn’t be achieved by training can be accomplished by a strong will. Will to act!
A primary purpose of a disk operating system is to enable the computer system to transfer data stored on a magnetic disk to other parts of the computer, such as primary memory, RAM, and printer.
Internal commands and external commands are the two types of MS-DOS commands.
While MS-DOS is a disk operating system, the command prompt is a common line interface that looks like MS-DOS.
The DOS architecture consists of four components: BIOS Module, Kernel, Command Processor, and External Commands.
No, Windows does not use DOS now. Windows Me was the last OS that was dependent on DOS.