All Windows systems include a series of commands that allow you to transmit commands directly to the operating system. They are known as CMD commands, DOS commands, or MS-DOS commands.
These are simple instructions that can be used in different ways, the best known of which is by entering them in the CMD command console (in fact, "CDM" corresponds to the name of the command or executable that opens the window or command prompt), although they can also be used in scripts or batch files.
What are CMD commands or MS-DOS commands?
The CMD command console, command interpreter or Command Prompt as some know it, is a tool included in all versions of Windows. It is a black window where the commands with the necessary commands and options are written and the Enter key is pressed to execute said command. So far easy enough, right?CMD command console or command prompt, with a simple command "cd xxx"
Access to the CMD command console
The CMD command console You can start it by searching for its access in: All Programs -> Accessories or by typing in the Start box, in Run or in Cortana: CMD and pressing the Enter key.
It is also possible to open an instance of the console within any directory or folder, for that with the Shift key pressed right click with the mouse and in the menu that appears choose «Open command window here«.
MS-DOS Commands Included in Windows
Windows CMD commands are an inheritance from early MS-DOS operating systems. In them, all the instructions had to be executed manually using commands similar to those in the list that we attach below.The use of these DOS commands remains fully valid today.
Many have been recently added as they were only used as self-contained packaged tools or kits for use by professionals.
We can extract additional information from the DOS command console such as the characteristics, how to use and options of any command typing the following:
Internal commands and external commands
Internal or resident DOS commands are those commands that are transferred to memory when the operating system is loaded. These commands are stored in a file named COMMAND.COM, and can be executed without the need to have DOS in the default drive -the drive where we are located-.
Some internal commands: CHCP, CHDIR, CLS, COPY, CITY, DATE, DEL, MKDIR, PATH, PROMPT, RENAME (REN), SET and TIME, among others.
External DOS Commandsrather, they are stored in separate or external files. It is necessary that we have this file in the default unit to be able to execute the order in question.
For example, the CHKDSK command is an external command. On Windows, it is located in the folder C: \ Windows \ System32 \ in the CHKDSK.EXE file.
Some external commands: CHKDSK, COMP, DISKCOMP, DISCOPY, FDISK, FIND, FORMAT, JOIN, KEYB
List of all CMD commands included in Windows
|ARP||MS-DOS command that caches the correspondence between the IP addresses and the physical addresses of the adapter or network card. It is used in networking tasks to optimize the performance of connections and to solve conflicts.|
|ASSOC||It shows or modifies the associations of the file extensions, that is, the action that Windows must perform according to the extension that the file has.|
|AT||The AT command schedules the execution of commands and programs on a computer at a specified time and date. The scheduling service must be running to use the AT command.|
|ATTRIB||Show or change the attributes of a file. In Windows, an attribute is assigned to each file, according to the role or objective that they are going to play on the computer, be it a hidden file, system, read-only, etc. With the ATTRIB command it is possible to know those established in a certain file and remove it or assign it another one.|
|AUDITPOL||It is used to show or change permission settings|
|BITSADMIN||It is used to create, manage and monitor file upload and download tasks.|
|BREAK||Sets or removes the extended check for Ctrl + C in the console.|
|BCDBOOT||BCD boot file creation and repair tool. The command line tool bcdboot.exe is used to copy essential boot files to the system partition and to create a new BCD store on the system.|
|BCDEDIT||Boot Configuration Data Store Editor (BCD)|
You can use Bcdedit.exe to add, remove, edit, and append entries in the boot configuration data store.
|BOOTCFG||This command-line tool can be used to configure, query, change, or delete the boot entry settings in the BOOT.INI file on pre-Windows Vista operating systems.|
|CACLS||MS-DOS command that displays or modifies file access control lists (ACLs).|
|CALL||Call a second batch from a running one.|
|CD||Show name or change to current directory|
|CHCP||Displays or sets the active code page number.|
|CHDIR||Show name or change to current directory, same as CD|
|CHKDSK||Check, verify and repair disk errors.|
|CHOICE||This tool allows users to select an item from a list of options and returns the index of the selected option.|
|CIPHER||Displays or alters the encryption of directories [files] on NTFS partitions.|
|CLEANMGR||MS-DOS command that frees disk space, allows you to save your options in memory.|
|CLIP||Redirects output from command line tools to Windows Clipboard. This text output can be pasted into other programs.|
|CLS||Erases and clarifies symbols or text on the screen.|
|CMD||Start a new instance of the console|
|CMDKEY||Create, submit, and delete stored usernames and passwords.|
|COLOUR||Sets the foreground and background colors of the console|
|COMP||DOS command that compares the contents of two files or a set of files.|
|COMPACT||This CMD command displays or changes the compression status of files on NTFS partitions.|
|CONVERT||MS-DOS command that converts FAT volumes to NTFS volumes. You can not convert the current unity.|
|COPY||Copy one or more files to another location|
|CSCRIPT||It allows executing VBS files on the console containing scripts written in VBScript language. It can also be used in batch files with the // B option, preventing scripting warnings and error messages|
|DATE||Show or set the date.|
|OF THE||Delete one or more files.|
|DEFRAG||Locate and consolidate fragmented files on local volumes to improve system performance.|
|DIR||Displays a list of files and subdirectories in a directory.|
|DISM||Provides information, installs, uninstalls, configures and updates additional features and Windows imaging packages.|
For example, to show installed Windows features that can be uninstalled use:
DISM.exe / Online / English / Get-Features / Format: Table
|DISKCOMP||Compare the contents of two floppy disks.|
|DISKCOPY||Copy the contents of one floppy disk to another.|
|DISKPART||Displays or configures disk partition properties.|
|DOSKEY||This CMD command edits command lines, memorizes Windows commands, and creates macros.|
|DRIVERQUERY||Displays the current status and properties of the device driver.|
|THREW OUT||Show messages, or turn echo on and off|
|ENDLOCAL||Terminate the search for environment variables of the batch file|
|ERASE||Delete one or more files, same as DEL|
|EXPAND||MS-DOS command that expands one or more compressed files|
|EXIT||Exits the CMD.EXE program (command interface)|
|FC||Compare two files or set of files and show the differences between them|
|FIND||Searches for a text string in one or more files.|
|FINDSTR||Search for text strings in files.|
|FOR||Execute a command simultaneously on multiple files, reducing the amount of code required for multiple tasks. It is one of the commands that offers the most practical benefits.|
|FORFILES||Use command something similar to FOR, select one or more files and execute a command in each one of them. It allows a multitude of useful options little exploited.|
|FORMAT||Allows you to give different formats to hard drives or other devices for use with Windows|
|FSUTIL||DOS command that displays or sets file system properties. It has several subcommands for effective administration of the file system and volumes.|
|FTYPE||Displays or modifies the file types used in a file extension association|
|GOTO||Directs the Windows command interpreter to a line in a batch file.|
|GPRESULT||MS-DOS command displaying group policy information by computer or user|
|GPUPDATE||Updates the changes made in the Local Group Policy Editor.|
Allows any of the established policies to be activated either immediately, upon restart or upon login.
To get them to activate immediately use: GPUPDATE / force
|GRAFTABL||Allows Windows to display an extended character set in graphics mode|
|HELP||Provides help information for Windows commands|
|ICACLS||MS-DOS command that displays, modifies, backs up, or restores access control lists (ACLs) for files and directories|
|IF||Executes commands conditionally, is used to define error values, compare strings, prove file existence, and make mathematical comparisons.|
|IPCONFIG||Displays the parameters of a network connection. By default, only the IP address, subnet mask, and default gateway are displayed for each TCP / IP-bound adapter.|
|LABEL||This CMD command Create, change or delete the volume label of a disk|
|MEM||Shows the amount of free and used memory on the system|
|MD||Create a directory or folder|
|MKDIR||DOS command to create a directory, same as above|
|MKLINK||Create symbolic links and hard links|
|MODE||Set up a system device|
|MORE||MS-DOS command displaying information screen by screen|
|MOVE||Move one or more files from one directory to another on the same drive|
|MSTSC||Initiate a remote connection to the desktop|
|NBTSTAT||Shows current TCP / IP connections and protocol statistics using NBT (NetBIOS over TCP / IP)|
|NET||Configure a wide variety of parameters in networks.|
|NETCFG||It is used to install Windows Preinstallation Environment (WinPE), a minimal and lightweight version of Windows used by developers|
|NETSH||The NETSH (Network Shell) command enables you to configure, conflict, and manage different network components using the command line locally or remotely.|
Displays and configures the status of the components of the installed network protocols. Netsh commands are organized in the form of a tree, each technology and protocol has its own context.
|NETSTAT||Shows current TCP / IP connections and protocol statistics. Allows monitoring of all active connections|
|NLSFUNC||Load the specific information of a country or region|
|NLTEST||The NLTEST command is used to test through secure channels between Windows computers in different domains and between trusted domain controllers.|
|NSLOOKUP||This CMD command displays information about the DNS servers assigned to your network connection. It allows making requests to these servers.|
|OCSETUP||Starts Windows Optional Component Setup tool that installs additional Windows options|
|OPENFILES||DOS command showing shared files opened by remote users|
|PATH||Show or set a search path for executable files|
|PAUSE||MS-DOS command that pauses the console and displays a message|
|PING||Allows you to test a network connection, sending and receiving a data packet.|
|POPD||Restores the previous value of the current directory saved by PUSHD|
|POWERSHELL||Runs an instance of Windows PowerShell, the new command console included in Windows on systems after Windows Vista.|
When PS is shown in the console symbol it means that you are in the PowerShell environment, so that you enter from that moment it will be related to this interpreter, to return to the console just type CMD and press Enter.
|Print a text file|
|PROMPT||Change Windows command prompt|
|PUSHD||MS-DOS command that saves the current directory and then changes it|
|QAPPSRV||Displays the RD session host servers available on the network|
|QPROCESS||Displays information about processes|
|I WANT||Shows the current status and parameters of a specific service|
|QUSER||Show information about users who have logged in to the system|
|QWINSTA||Displays information about Remote Desktop sessions|
|RASDIAL||It is used to start or stop a dial-up or dial-up connection.|
|RD||Remove or delete a directory or folder|
|RECOVER||DOS command to recover readable information from a damaged or faulty disk|
|REG||It is used to manage all the Registry Editor parameters from the command line and batch files. It is possible to add, modify keys, values, export branches, etc.|
The REG command is made up of several subcommands, each one for a completely different use, they are:
REG QUERY, REG ADD, REG DELETE, REG COPY, REG SAVE, REG RESTORE, REG LOAD, REG UNLOAD, REG COMPARE, REG EXPORT, REG IMPORT and REG FLAGS
|REGEDIT||The REGEDIT command allows you to import, export or delete settings in the registry from a plain text file with a .reg extension.|
|REGSVR32||Register DLL libraries to incorporate them into the registry|
|RELOG||Relog creates new performance records from existing performance record data by changing the sampling interval or converting the file format.|
Supports all performance log formats, including Windows NT 4.0 compressed logs
|REM||Mark comments in batch files or CONFIG.SYS. The line in a batch that begins with REM is considered a comment|
|REN||DOS command that renames one or more files|
|RENAME||Rename one or more files, same as above|
|RMDIR||Remove a directory|
|ROBOCOPY||Advanced utility to copy folders and directories in Windows.|
|RESET SESSION||(Rwinsta) Reset session subsystem hardware and software to known initial values|
|ROUTE||DOS command to manipulate network routing tables|
|RPCPING||Pings the server using RPC|
|RUNES||It is used to run a program using the credentials or rights of another user|
|SECEDIT||Analyze the security of the system and make the comparison with a specific template|
|SET||Show, set, or remove Windows environment variables|
|SETLOCAL||Start the local environment changes section in the console|
|SETVER||The SETVER command is used to set the MS-DOS version number that is reported to a program|
|SETX||Create or modify environment variables in the user or system environment. You can set variables based on arguments, registry keys, or file input|
|SC||Show or configure services (background processes).|
|SCHTASKS||Run Task Scheduler. Schedule commands and programs to run on a computer.|
|SFC||Microsoft Resource Checker Examines the integrity of all protected system files and replaces incorrect versions with correct Microsoft ones|
|SHADOW||Monitor another Remote Desktop Services session|
|COMPARTIR||The SHARE command is used to lock files and functions in MS-DOS|
|SXSTRACE||WinSxs Tracking Utility|
|SHIFT||Change position of replaceable modifiers in batch files|
|SHUTDOWN||Allows local or remote shutdown, reboot, suspension and hibernation of a computer|
|SORT||Sort the results of a selected command, for example the results of a search with FIND|
|START||Starts another window to run a program or command|
|SUBST||Associate a path with a drive letter|
|SYSTEMINFO||Displays specific equipment properties and settings|
|TAKEOWN||This tool allows the administrator to regain access to a denied file by reassigning ownership of the file.|
|TASKLIST||Shows all running tasks, including services|
|TASKKILL||MS-DOS command that terminates or interrupts a running process or application|
|TCMSETUP||This DOS command is used to configure or disable the Telephony Application Programming Interface (TAPI) telephony client.|
|TIME||Show or set the system time|
|TIMEOUT||This utility accepts a timeout parameter to wait for a specified period of time (in seconds) or until a key is pressed. Also accepts a parameter to skip the keypress|
|TITLE||Sets the window title of a CMD.EXE session|
|TRACERPT||The TRACERPT command is used to process real-time data or event trace logs|
|TRACERT||It allows you to track the route between one computer and another on the network, it is widely used to know where a data packet has stopped on the network.|
|TREE||DOS command that graphically displays the directory structure of a drive or path|
|TSDISCON||Disconnect a Remote Desktop session|
|TSKILL||Terminate a process|
|TYPE||Displays the content of a text file|
|TYPEPERF||Typeperf writes performance information to the command window or to a log file. To stop Typeperf press CTRL + C|
|TZUTIL||Windows time zone utility|
|UNLODCTR||Removes the counter name and long text for the specified repeating counter|
|WATCH||Show Windows version|
|VERIFY||Tells Windows if it should check that the files are written correctly to a disk|
|VOL||Displays the volume label and serial number of the disk|
|VSSADMIN||Volume Shadow Copy Service administrative tool, images created by Windows for System Restore function.|
For example, to list all existing images use: VSSADMIN list shadows
|W32TM||Tool used to diagnose conflicts of the local computer or one on the network with the Windows Time service (Windows time) when trying to synchronize or update the system clock|
|WAITFOR||This tool sends or waits for a signal to arrive in a system. If / S is not specified, the signal will be broadcast to all systems in a domain. If / S is specified the signal will only be sent to the specified domain|
|WBADMIN||Backup command line tool|
|WEVTUTIL||Windows event command line utility. Retrieve information about event logs and publishers, install and uninstall event manifests, run queries, and export, archive, and delete logs|
|WHERE||DOS commands showing the location of files that match the search pattern. By default, the search is done in the current directory and in the paths specified by the PATH environment variable|
|WHOAMI||This utility can be used to obtain the destination of user name and group information along with the respective security identifiers (SID), privileges, login identifier (login ID) of the current user (access token ) on the local system. That is, who is the currently logged in user. If no modifier is specified, the tool displays username in NTLM format (domain \ username)|
|WINHLP32||MS-DOS command that runs Windows help files that use the HLP extension|
|WINRM||Windows Remote Management command-line tool Windows Remote Management (WinRM) is Microsoft's implementation of the WS-Management protocol, which provides a secure way to communicate with local and remote computers using Web services|
|WINRS||DOS command that opens a command window in safe mode with a computer on the network|
|WINSAT||Windows System Assessment Tool (WinSAT)|
|WMIC||Displays WMI information in the interactive command shell. It allows access to all kinds of information, both from the local computer or another on the network, lists all the hardware and software data available|
|XCOPY||Copy files and directory trees|
Practical usage examples for MS-DOS
Next I show you a couple of examples so you can see how CMD commands work in practice:
- copy source_filedestination_file: Create a duplicate file of any file.
- of the fastboot.txt: Deletes the selected file, in this case, the file named fastboot.txt.
- shutdown –r –f –t 5: Computer restart after 5 seconds of waiting.
- net user username / domain: Shows the properties of a domain user (last password change, account active or not, groups to which it belongs ...).
- systeminfo: Shows all the properties of the computer such as the operating system, processor, computer name, physical and virtual memory, etc.
- nbtstat –a ip_equipo: By entering the IP of a device you can obtain the name of the machine and the MAC
Use of special characters: asterisk and question mark
The special characters or wildcards, allow to use the same command with several files:
The asterisk * helps us to work with files with a similar name and serves to represent several characters. For example, the command DIR * .TXT it will show us all the files with the TXT extension located in the current folder.
The question mark it is very similar to the asterisk. The only difference is that the? only serves to replace a single character. For example, the command DIR FASTBOO? .TXTit will show us all the files that start with FASTBOO and have a TXT extension.
Establish connection with your Android device using ADB and Fastboot commands
We can also take advantage of an MS-DOS or Powershell terminal to communicate with an Android mobile or tablet from the PC, using a USB cable and a few commands. They are called ADB commands (Android Debug Bridge) and are used to carry out different tasks on Android systems, such as restarting the terminal, installing an application or entering the device's recovery mode.
Here we go over 10 of the most prominent ADB commands.
|adb devices||It is used to know if the device is communicating correctly with the PC. If everything has gone well, we will be shown a list of the connected devices with their respective serial number and status.|
|adb install||With this command line we can install applications in apk format on the device.|
|adb push||Command to transfer files from the PC to the indicated path of the Android device.|
|adb pull||Copy files from device to PC.|
|adb reboot||Restart the Android device.|
|adb reboot-bootloader||Reboot the device and load the bootloader.|
|adb reboot-recovery||Reboot the device and load the recovery menu.|
|fastboot devices||Confirm if our Android has fastboot mode enabled and is connected.|
|adb shell||Command to view the content and permissions of the terminal files and folders. Allows you to change permissions.|
|adb logcat||Shows logs of recorded events.|
You can see the operation of these commands in greater detail in the Basic guide to ADB commands for Android.
With regard to Fastboot, these are the commands that we can use:
|update||flash device from update.zip|
|flashall||flash boot + recovery + system|
|flash ||write a file to a flash partition|
|erase||delete a flash partition|
|format||format a flash partition|
|getvar||show a variable from the bootloader|
|boot ||download and boot the kernel|
|flash: raw boot ||create a boot image and flash it|
|devices||list of connected devices|
|continue||continue with autostart|
|reboot||restart the device normally|
|reboot-bootloader||reboot device in bootloader|
|help||show help message|
You can get more details about how these commands work in the Fastboot for Android practical usage guide.
Another way to run CMD commands in Windows
All the CMD commands mentioned above can also be run from the Start box without having to open the MS-DOS console.
To do this, do the following:
➔ Write CMD / K command + option
This will execute the command with the option and leave the CMD window open.
➔ Write CMD / C command + option
This will execute the command with the option and close the CMD window when finished.
CMD / K IPCONFIG / ALL CMD / C START //google.com
CMD / C START //google.com