The Windows CMD, better known as Command Machine or Command Prompt, is an integrated program in Windows whose possibilities allow us to interact with the different functions of the system. From accessing folders or creating files to fixing external hard drives and SD cards. All this through CMD commands, which must be used by a series of arguments.
Weeks ago we showed the complete list of commands compatible with CHKDSK to repair hard drives. On this occasion, we have compiled all the CMD commands for Windows.
Commands for Command Prompt
Before getting into the subject with basic commands and advanced CMD commands, you should know some of the most useful commands to interact with the Windows console itself.
- help: show all commands compatible with the CMD using a list that details all its functions.
- exit: close the current window of the CMD.
- cls: clean the command lines entered, as well as the answers from the machine.
- Color: Change the color of the console, either the wallpaper or the letters. It can be used with other commands to expand its functions. For example, color 1F to change the background to blue and the letters to white.
- See: Check the version of Windows 10 that we have installed.
- time: see the current time of the computer.
- date: show or set a new date.
- systeminfo: show the information related to the hardware of our computers, such as the amount of RAM installed, the processor model or the amount of storage available.
- logoff: close the current user session completely.
- shutdown: turn off the computer completely. Together with other complementary commands, we can configure aspects such as the time or the exact time to turn off the equipment. For example, shutdown -r to restart the computer or shutdown -s -t 60 to shut down the computer in 60 seconds.
Windows CMD basic Commands
If you are a beginner and you like to start using CMD with basic and easy to remember commands, the program integrates a series of commands that allow us to create files, change the extension of a certain item or copy entire folders on hard drives and drives removable, among many other functions.
- dir: list the contents of a certain directory or folder to view all the files and folders hosted in the indicated path.
- cd: access or go back to a specific directory or system folder. For example, cd/pictures or cd: to go back to the current directory or folder.
- md: create a folder with the name indicated next to the command. For example, md pictures or md memories.
- type: create a file with the name and extension indicated next to the command. For example, type document.txt or music.rtf. It can also be used to write text in compatible files. For example, robocopy C: \ foo C: \ bar / E or robocopy C: \ foo C: \ bar / COPYALL / E / R: 0
- copy: copy one or more files in the indicated path. For example, copy song / Music or copy song.mp4 / Music.
- robocopy: copy one or more files in the indicated path. The difference when comparing to copy is based on the possibility of copying heavy files and directory trees, as well as stopping the copy and even canceling it if we wish.
- move: move one or more files in the indicated path. For example, move song / Music or move song.mp4 / Music.
- rename: change the name or extension of a certain file. For example, rename song.mp3 song.mp4 or rename text1 text2.
- del: delete the indicated file or folder. For example, the song or the song.mp4.
CMD Commands for Hard Drives and Removable drives
Beyond CHKDSK and DISKPART, there are many commands that allow us to interact with internal hard drives and internal storage units, such as pen drives, SD cards or external hard drives. Functions that go from repairing a certain unit to formatting it in case it does not work properly.
- diskpart: show and configure the partition properties of a particular disk. Once the command has been entered, it must be used together with other complementary commands. For example, clean C to clean disk C, select disk C to select it, or list disk to see a list with all disks inserted.
- diskcomp: compare the contents of two disks or storage units. For example, diskcomp [C: [E:]].
- format: format and delete the data of a certain unit in a format compatible with Windows. For example, format C or format E:.
- convert: convert disks in FAT format to disks in NTFS format. For example, convert F or convert E:.
- chkdsk: analyze a certain storage unit. Together with other supplementary commands, it is capable of carrying out actions such as formatting a disk or checking its sectors for later repair. For example, chkdsk / F to solve the errors of a unit or chkdsk / R to repair the bad sectors and recover the information.
- defrag: defragment a hard disk to sort the information and improve its performance in the case of a mechanical hard disk. For example, defrag C or defrag E:.
- cleanmgr: analyze and clean the main Windows drive to free up space similar to the Windows Space Free tool. For example, cleanmgr C or cleanmgr E:.
CMD Commands for Networks
Another of the main functions that CMD supports has to do with the use and diagnosis of networks with commands such as the well-known IPCONFIG.
- ipconfig: show the network information of our computers, such as the IP of our PC, that of our router or the subnet mask.
- netstat: display network information related to TCP / IP connection protocols and connection ports.
- getmac: show the MAC address of our computer to know its network identity.
- tracert: show the route of our computer when sending a certain package to the host address that we indicate to verify the status and security of the connection. It can be used together with other commands to expand its functions. For example, tracert techidence.com.
CMD Commands for Windows Programs
In addition to the tools derived from the network functions and disks, the Windows CMD allows you to interact with programs and system processes in case they show some kind of error.
- control panel: open the classic Windows control panel.
- tasklist: show the complete list of running processes of the system and applications. In conjunction with other commands, we can close processes and kill them permanently. For example, taskkill / PID 609 to close the process that corresponds to PID 609.
- driverquery: show the complete list of the drivers installed on the computer to recognize their respective components.
Advanced CMD Commands for Windows
In addition to the commands we have just seen, there are a lot of instructions that allow us to access specific functions of the CMD. We can also use these same instructions to create small programs by pasting the code in a BAT file to perform actions automatically, commonly known as files or batch programs.
- call [X]: call a batch program from another program
- chcp: show or set the code page number.
- chdir [X]: show or rename the current directory.
- chkntfs [X]: show or change disk check at system startup.
- cmd: Start a new Windows CMD window.
- compact [X]: show or change the compression status of files in partitions with NTFS format.
- doskey: edit, retrieve and create command lines for the Windows CMD.
- echo “X”: launch messages and text strings in the CMD.
- erase [X]: delete one or more files.
- fc [X]: compare two or more files and show the differences between them. It is less complete than compare.
- find [X]: Search for a message in one or several files at once.
- findstr [X]: Search for a text string in one or several files at once.
- for: parameter used to execute loops in executable files, which executes a series of lines as many times as indicated as long as the condition imposed is met.
- if: parameter used to execute loops in executable files, which executes a series of lines if a certain condition is met.
- label [X]: create, delete or change the volume label of a particular disc.
- mode [X]: configure a system device.
- openfiles: show all open files that have been shared with other users
- pause: suspend the execution of a batch file.
- print [X]: print a certain text file per screen.
- rd [X]: delete a certain directory.
- ren [X]: Rename one or more files at a time.
- replace [X]: replace files.
- rmdir [X]: delete a certain folder or directory.
- sc: show system services running in the background.
- title [X]: set the title of the CMD window.
- tree [X]: show the directory structure of a particular drive or path.
- type [X]: show the contents of one or more text files in TXT, RTF, BAT format…
- verify [X]: check that the files are written correctly on a certain disk.
- vol [X]: show the label of a certain volume and the serial number of the chosen disk.
- xcopy: copy files and directory trees.
This post may contain affiliate links, which means that I may receive a commission if you make a purchase using these links. As an Amazon Associate, I earn from qualifying purchases.