Posted by admin at July 22, 2021
CMD stands for Command (.CMD). A command is an instruction given to a computer program that tells the program what has to be done. It is an application that is found in most computers with Windows as the Operating System, and it helps in the execution of the commands entered. It is also called Command Prompt or Windows Command Processor.
Command prompt has become increasingly popular with people having no background in IT as it helps to automate several tedious, mundane tasks with the help of a few clicks. The interface allows the user to run multiple commands, and the commands can be executed one after the other. This has proved a boon in the world of automation.
Most users find it difficult to learn and cannot use Command prompt as compared to the user-friendly interface that is available on the modern apps, however, Command prompt can still be used in many situations.
Opening Command Prompt in the Windows Operating System is as simple as a few clicks.
Step 1: Go to the Start Menu. This is at the bottom left of the screen. RUN.
Step 2: Type cmd in the search bar and hit Enter. The ones who love shortcuts in Windows can also use Ctrl+R which routes them to RUN, and then they can search for cmd and hit enter. The best thing about these commands in Windows is that they are not case sensitive, which makes it user friendly.
Let us now look at some of the basic and most commonly used CMD commands in the Command Prompt. In the next section, let us see the list of CMD commands with syntax.
Note: It is important to note that these commands are not case sensitive.
#1) CD- Change Directory
This command allows users to change from one directory to another or move from one folder to another.
Syntax: CD [/D] [drive:][path]
Example: C:>CD Prog
Some of the other parameters of this command are discussed below. This will make this command more useful.
Parameter- cmd device: This parameter gives specific information about the device which will be used for input and output.
Parameter /d: This parameter is used when the user wants to change the current directory and the current drive as well.
#2) Mkdir
This command is used when subdirectories are to be created within the directories.
Syntax: mkdir [<drive>:]<path>
Example: mkdir fantastic ( to create a directory name “ fantastic”)
#3) REN: Rename
Syntax: ren [<drive>:][<path>]<filename1> <filename2>
Example– ren /?
#4) ASSOC: Fix File Associations
This is one of the most basic and most common commands. It helps to associate (as the name suggests) some file extensions to some programs. For Example- When we click on .doc (extension), the computer is able to decide that it needs to associate it with Microsoft Word. The screenshot below shows an example of how this command works.
Syntax: assoc [.ext[=[fileType]]]
Example: – C:\Users\assoc.txt
#5) FC File compare
The second most common command used is FC, also known as File Compare. This is an interesting feature that allows comparing files that have been changed over time.
Syntax: FC /a [/c] [/l] [/lb<n>] [/n] [/off[line]] [/t] [/u] [/w] [/<nnnn>] [<drive1>:][<path1>]<filename1> [<drive2>:][<path2>]<filename2>
FC/b [<drive1:>][<path1>]<filename1> [<drive2:>][<path2>]<filename2>
Example: FC File 1.txt File 2.txt
There are a few other parameters of FC command, explained below-
Parameter- /a: This parameter helps to concise the output when ASCII comparison is done. It shows the first and the last line in the list of differences.
Parameter /c: This parameter ignores the case sensitive aspect of letters.
Parameter /w: This parameter is very useful when files are compared. It eases the process of comparison of files by compressing or removing the white space in the process of comparison. This parameter /w in the FC command disregards the white space, if any, at the beginning and end of the line.
#6) POWERCFG: Power Configuration
This command gives a report of the power settings of the computer. In situations when the power of the computer drains out quickly, this command can help to generate a complete power efficiency. The report is generated within a minute and is extremely useful to detect any warnings which may impact the performance of the system.
Syntax: powercfg /option [arguments] [/?]
Example: powercfg /?
Another parameter of this command is /list, /L. This parameter lists all the power sources.
#7) SHUTDOWN: Turn off Computer
This command is a very resourceful command. By using this command, users can not just shut down computers but also can control the process of the shutdown. This command is popular in situations where shutdown is part of a planned task.
Users can type shutdown/i on the command prompt and choose to either restart or a complete shutdown on the GUI dialogue box that appears. Users have a choice to avoid this GUI dialogue box by typing the shutdown/s command.
Syntax: shutdown [/i | /l | /s | /sg | /r | /g | /a | /p | /h | /e | /o] [/hybrid] [/fw] [/f] [/m \\computer][/t xxx][/d
e) PROMPT: Using this command, the command prompt can be changed to another drive from C:\>.
Example- prompt –$g In this example, the command will display an arrow (–> ) type.
f) TITLE: This command is used to make alterations to the title of the command prompt window.
Syntax: title [<string>]
Example: title /?
Parameter <string>: This parameter helps to set the title of the command prompt. It specifies the text which shows as the title of the command prompt.
g) REGEDIT: This command is extremely popular when keys are edited in the Windows registry. This command should be used very carefully.
Syntax:
reg add
reg compare
reg copy
reg delete
reg export
reg import
reg load
reg query
reg restore
reg save
reg unload
h) ROBOCOPY: This command is used to copy files or directories from a particular location to a different location. It can also be used to copy an entire drive.
Syntax: robocopy <source> <destination> [<file>[ …]] [<options>]
Now, let us also discuss some CMD commands for Network.
#14) IPCONFIG: IP Configuration
This command is extremely useful when troubleshooting for the network is required. When we type IPCONFIG in the command prompt, we get detailed information like IP address, Subnet Mask, Default Gateway IP, and current domain about the network. These details are important in the troubleshooting process of the router or any other connectivity issue.
Syntax: ipconfig [/allcompartments] [/all] [/renew [<adapter>]] [/release [<adapter>]] [/renew6[<adapter>]] [/release6 [<adapter>]] [/flushdns] [/displaydns] [/registerdns] [/showclassid <adapter>] [/setclassid <adapter> [<classID>]]
Example-C:\Users\IPCONFIG
#15) Network Statistics NETSTAT
This command ensures the prevention of any virus attack on the computer. We need to type “NETSTAT” in the command prompt and we get details of all the TCP connections which are currently active.
Syntax: NETSTAT [-a] [-b] [-e] [-n] [-o] [-p <Protocol>] [-r] [-s] [<interval>]
Example: C:\Users\Netstat (shows active connections)
#16) TRACERT: TRACEROUTE
TRACERT is a really interesting command offered by Windows. It is especially meant for users who want to look at the routing of Internet traffic from their own browser to any remote system like a Google server. As the name suggests, it traces the route of the packets which are sent to a remote address which can be a website or even a server.
The information this command provides includes:
This command wonderfully displays the route and hops of any Internet request and how these change when the location to access the web changes. It also helps to detect glitches in a router or a switch on a local network.
Syntax: TRACERT [/d] [/h <maximumhops>] [/j <hostlist>] [/w <timeout>] [/R] [/S <srcaddr>] [/4][/6] <targetname>
Example: C:\Users\ Username>TRACERT google.com
#17) PING: Send Test Packets
This command is extremely useful, especially for IT Professionals. It helps the analyst run checks if the computer is able to access and connect to another computer or another network. It also helps to detect if there are any issues with the connection.
This command also tracks the time for sending packets and this time is calculated in milliseconds, which is quick enough to detect any network glitches. In the below screenshot, the required details can be entered in the format specified to get the information.
Syntax: PING [/t] [/a] [/n <count>] [/l <size>] [/f] [/I <TTL>] [/v <TOS>] [/r <count>] [/s <count>] [{/j <hostlist> | /k <hostlist>}] [/w <timeout>] [/R] [/S <Srcaddr>] [/4] [/6] <targetname>
Example: C:\Users\username\ PING[-t]
Some of the parameters used for this command are mentioned below:
Parameter /t: This parameter is used to send Ping requests to a specific destination until there is an interruption.
Parameter /n<count>: This parameter states the count of echo requests sent. The default count is 4.
#18) PathPing
This command serves the same purpose as that of TRACERT but yields more information. It provides a detailed analysis of the route that a packet sent to a particular destination takes. It also provides information for loss of packet at each hop it takes.
Syntax: pathping [/n] [/h <maximumhops>] [/g <hostlist>] [/p <Period>] [/q <numqueries> [/w <timeout>] [/i <IPaddress>] [/4 <IPv4>] [/6 <IPv6>][<targetname>]
Example: C:\ Users\pathping www.google.com
#19) GETMAC Media Access Control
Media Access Control is a unique address that is assigned by the manufacturing company to all the devices which meet the standards of IEE 802. This MAC address also helps users to keep control of devices that are allowed to connect to the network. It is possible to see multiple MAC addresses, and this is because there could be multiple network related adapters on the network.
Syntax: getmac[.exe][/s <computer> [/u <domain\<user> [/p <password>]]][/fo {table | list | csv}][/nh][/v]
Example: C:\Userss\getmac /?
#20) NSLOOKUP- Name Server Lookup
This command helps the users to find the records pertaining to the name server of any domain name.
Syntax: nslookup [exit | finger | help | ls | lserver | root | server | set | view] [options]
Example: C:\Users\Username>nslookup
#21) NETSH- NETWORK SHELL
This command is a network command which is used for gathering details of network adapters available on the system. It helps to check and set up the network adapters.
Syntax: netsh [-a <Aliasfile>][-c <Context>][-r <Remotecomputer>][-u [<domainname>\<username>][-p <Password> | [{<NetshCommand> | -f <scriptfile>}]
Example: C:\Users\netsh dump \?
Parameter /?: This parameter shows the list of commands.
Parameter dump: This parameter displays a configuration script.
#22) ARP
Arp command allows the user to show, delete, and make additions to ARP information of the devices on the network.
Syntax: arp [/a [<inetaddr>] [/n <ifaceaddr>]] [/g [<inetaddr>] [-n <ifaceaddr>]] [/d <inetaddr> [<ifaceaddr>]] [/s <inetaddr> <etheraddr> [<ifaceaddr>]]
Example: C:\Users\arp –a
#23) NBTSTAT
This command helps to show all the current protocol statistics and current TCP/IP connections (NETBIOS over TCP/IP). It uses NBT to resolve issues related to NETBIOS name resolution.
Syntax: nbtstat [/a <remotename>] [/A <IPaddress>] [/c] [/n] [/r] [/R] [/RR] [/s] [/S] [<interval>]
Example: C:\Users\nbtstat
#24) Finger
This command helps to gather information about the user. This can include information related to the last login, last read time for emails, etc.
Syntax: finger [-l] [<user>] [@<host>] […]
Example: finger @ host: This parameter specifies the server on the remote system from which user information is required.
#25) Hostname
This command shows the hostname of the computer.
Syntax: hostname
Example: C:\Users\hostname
#26) Net
This command allows the user to see and find out details of the network settings and update and solve network related issues.
Syntax: net [accounts | computer | config | continue | file | group | help | helpmsg | localgroup | name | pause | print | send | session | share | start | statistics | stop | time | use | user | view]
Example: C:\Users\net [accounts]
#27) Route
This command is used to check and make changes to the route table of the computer.
Syntax: route [-f] [-p] [-4|-6] command [destination] [MASK netmask] [gateway] [METRIC metric] [IF interface]
Example: C:\Users\route. PRINT
#28) WHOIS
This command is useful when users want to find the domain name or the IP address. It searches the WHOIS database for relevant objects.
Syntax: whois [ -h HOST ] [ -p PORT ] [ -aCFHlLMmrRSVx ] [ -g SOURCE:FIRST-LAST ]
[ -i ATTR ] [ -S SOURCE ] [ -T TYPE ] object
Example: whois [-h]
Note: This command could not be executed due to admin restrictions.
Parameter whois –v: This parameter is used to print the whois information for the domain name.
Usage: whois.exe[-v]domainname [whois.server]
Interestingly, there are some useful tricks of command prompt which helps to enhance the experience of using Windows CMD commands and will prove to be time-saving as well.
Let us share some of the useful tricks below-
#1) Command History
This trick helps users to recall commands which have been used in the past but they are not able to recall.
Trick: doskey/history
#2) Run multiple commands
This trick is very efficient and time-saving when more than one command needs to be run back to back. All we need to do is to use “&&” between the two commands.
Example: assoc.txt && IPCONFIG
#3) Function keys and their usage
We have discussed an extensive list of commands available in the command prompt. Now, you must be thinking if you need to remember all of them? The answer is No.
We have been talking about the user-friendliness of Command Prompt in Windows and trust me, in case one forgets these commands, it is easy to retrieve the list of commands.
Follow the below-mentioned steps-
Step 1: Open the Command Prompt by clicking on the Start Menu and typing cmd. Alternatively, one can also use a shortcut- Ctrl+R (key), and on the Run dialogue box, type cmd, and press Enter.
Step 2: In order to retrieve the list of commands- Type Help and press Enter. This will help to list down all the commands in alphabetic order, and the commands can be found by scrolling up and down. The list may vary depending upon the version of Windows used.
Below is a list of the function keys which can help to enhance the experience with CMD commands.
#4) Send output to clipboard
This trick is very useful and efficient when the result or output of command needs to be saved. This trick saves a lot of time by saving the output of the command to the Windows clipboard as against the traditional copy and paste method.
Trick: Assoc.txt| clip
#5) Abort Command
This trick helps to stop the execution of command if the Enter key has been pressed by mistake.
Trick: CTRL+C
Command Prompt is a part of all systems with Windows NT based operating system. The list of commands which are available in the command prompt is long however these commands and their availability may be different on different versions of Windows Operating Systems like Windows 7, Windows 8, etc.
There are advanced versions of Command prompt in Windows which are called PowerShell and are now a part of the latest versions of Windows. PowerShell serves the purpose of a booster to the running of commands in Command Prompt. It is believed that in the newer versions of Windows, Windows PowerShell may substitute command prompt.
Comments