English
+370 5 205 5502 sales@monovm.com

Important commands in Windows

Windows command-prompt commands are handy for everyone who wants to perform day-to-day tasks. It will be time-saving to manage every task from a single interface.

29 Apr, 22 by Susith Nonis 17 min Read

List of content you will read in this article:

Windows OS comes with an excellent feature of a command-line tool that allows users to perform any action and handling and application within the system via several commands. From a technical perspective, these commands are handy and save time to go through the entire system and provide a single interface to manage everything. Command-line (CMD) commands are straightforward to understand and execute. It comes as an integral part of every Windows system. 

If you are a regular Windows user, you must get along with all the basic to advanced CD commands as per your usage. This article shares some important and frequently used commands that are must-know for every Windows user.

CMD (commands) specifies the set of instructions given to the OS to perform the specific action. This CMD application is available in every Windows OS. it allows the users to manage all the system settings, applications, and tasks. It is an interface that allows the user to perform tasks on remote desktops. For that, the user has to provide a particular command. So, you must know various commands to get your work done quickly. 

The usage of the Command prompt is not only limited to experienced IT professionals. Still, it helps beginners automate tedious tasks and get them done automatically as per their settings. You can set the tasks to be performed at a specific time with a few clicks. You can also run several commands simultaneously, and they will run on a priority basis.

Command prompt commands come with easy-to-understand syntax, making them useful for everyone. 

You only have to use a few clicks to open the command prompt on your Windows system. You can follow the below-mentioned steps to get started. 

  • Go to the Start Menu and open RUN.
  • Type cmd in the search bar and hit Enter. Also, you can use the Windows shortcuts for opening the command-prompt using Ctrl+R that opens the RUN, and then they can search for cmd and hit enter. 

While running the CMD command, you should know that these commands are not case-sensitive.

1. ASSOC: Fix File Associations

Every file on the Windows system has some file extension. But some, certain file extensions are added with specific programs. These extensions help the system understand which file will open with what program. For example, the system will open the pdf file in Adobe. ASSOC is the CMD command for knowing about the entire file associations, as shown below. It will display the file extension and the program it is associated with.

2. FC: File Compare

Some files get changed over time, and you can see several versions of the same file on the system. Thus it will be challenging to understand the difference among all the versions. The command prompt comes with the command to compare the files and view the relevant differences among them using the following command. 

The FC command carries out either an ASCII or a binary file comparison and displays the available differences. For example, 

Fc /a F1.txt F.txt will compare two ASCII files.

Fc /b Pic1.jpg Pic2.jpg will make a binary comparison on two images.

3. IPCONFIG: IP Configuration

IPCONFIG is the network-related command that has made network debugging easier. This command will provide you with detailed network information, as mentioned below.

  • Current IP Address
  • Subnet Mask
  • Default Gateway IP
  • Current domain

4. NETSTAT: Network Statistics

Suppose you are concerned about any malware running on your system connecting to internet locations without your knowledge. You can use the NETSTAT command in the command prompt. It will provide you with a list of all active TCP connections from your computer.

5. PING: Send Test Packets

If you are an analyst, you will frequently use the PING command. This command will send the test packets over the network to the destination system when you execute it.

You can use the PING command to check if your system has the required access to another computer, a server, or even a website. You can also check if your system is disconnected from the network. You will get the transit time for the packets in milliseconds and tell you about a bad network connection.

6. TRACERT: Trace Route

TRACERT is an outstanding Windows Command that will tell you about the path your internet traffic will take from your browser to a remote system, such as Google servers.

The command stands for “Trace Route”, which will send the packets to a remote destination and display all of the information, such as 

  • Number of hops before reaching the destination
  • Time took on each hop
  • The IP, along with the name of each hop

It will also mention how your internet requests’ routes change based on accessing the web. You can simply troubleshoot a router or switch on a local network that may be problematic.

You can also check how to Traceroute on Mikrotik here. 

7. POWERCFG: Power Configuration

If you are worried about how quickly your device is running out of power, you can change your power settings accordingly. Windows offers a CMD command called POWERCFG (power configuration) to manage those settings. You need to have administrator access to run this command and type powercfg – energy to get a complete power efficiency report.

The output will generate in a few minutes, and you can check if there are any warnings or errors that will help you to improve the power efficiency of your system.

You can check the energy-report.html file and get the details of those errors and warnings.

8. SHUTDOWN: Turn Off Computer

The SHUTDOWN command comes with several purposes as it not only lets you shut down the computer but allows you to control shutdown behaviour. After patching your computer system, you can use this command to schedule a specific task or any IT batch job.

Typing shutdown /I from the command prompt will start a shutdown process, but it will open a GUI to allow the user to restart or do a complete shutdown. If you want to skip the GUI pop-up, you can just use a shutdown /s command.

This command comes with a long list of parameters that allow you to do a logoff, hibernate, restart, etc. To check the available parameters, just use shutdown without any arguments to see them all.

9. SYSTEMINFO: System Information

For getting the details about what brand of network card you have, processor details, or the version of your Windows OS, you can execute the SYSTEMINFO command via command prompt.

This command will pull the necessary information about your system and list them in a clean format that is easy to read.

10. SFC: System File Checker

If you are unaware of which virus or software has corrupted your core system files, you can use the most critical Windows command that will scan those files and ensure their integrity.

For this, you need to open CMD using as administrator and type the SFC /SCANNOW to check the integrity of all the system files. Once you get to the actual problem, you can repair the files with backed-up system files.

You can use the following parameters with this command.

  • /VERIFYONLY: Check the integrity without repairing the files.
  • /SCANFILE: Scan files’ integrity and fix it if corrupted.
  • /VERIFYFILE: Verify the integrity of files without repairing them.
  • /OFFBOOTDIR: repair the files on an offline boot directory.
  • /OFFWINDIR: repair the files on an offline Windows directory.
  • /OFFLOGFILE: Specify a path for saving a log file along with the scan results.

The entire process will take some time.

11. NET USE: Map drives

Command-prompt also lets you map a new drive on your system using the NET USE command. For example, if you have a shared folder on a device within your network called \\OTHER-COMPUTER\SHARE\, and you want to map this as your Z: drive, you can use the following command: do this.

Net use Z: “\\OTHER-COMPUTER\SHARE” /persistent: yes

The persistent switch tells your device that you want this drive remapped whenever you log back into your computer.

12. CHKDSK: Check Disk

Using the SFC command will only allow you to check the integrity of your system files, but using the CHKDSK command will scan an entire drive.

If you want to check the C: drive and repair any existing problems, you can simply launch the command window as an administrator and type CHKDSK /f C:

This command will check the following.

  • File fragmentation
  • Disk errors
  • Bad sectors

This command will fix any disk errors also. On completion of the command, you will get the status of the scan and what actions were taken.

13. SCHTASKS: Schedule Tasks

Windows comes with an interface allowing you to create scheduled tasks. For example, you can create a BAT (batch) file on C:\temp and schedule it as per your requirement.

It would be best if you used the Scheduled Task wizard to configure the task, or you can run a command via the command line for this. The SCHTASKS command has the following syntax.

SCHTASKS /Create /SC HOURLY /MO 12 /TR Example /TN c:\temp\File1.bat

The scheduled switch accepts parameters, such as minute, hourly, daily, and monthly and you can also specify the frequency with the /MO command.

14. ATTRIB: Change File Attributes

In Windows, you can right-click on a file to change its attributes and find the right property to alter. Rather than hunting around the files to change the attribute, you can execute the ATTRIB command and set the required file attributes.

ATTRIB +R +H C:\temp\Fi1.bat will set Fi1.bat as a hidden, read-only file.

If the commands run successfully, you will not get any response; otherwise, you will get an error message.

15. BITSADMIN

You can use this command for uploading or downloading data within a network or through the Internet. You can even use it to check the transfer of the file.

For example- 

bitsadmin [/RAWRETURN] [/WRAP | /NOWRAP] command

16. COLOR

You can use this command to change the command prompt window’s background and foreground colour.

For example-  color [[<b>]<f>]

Example: color /?

This command comes with some parameters as shown below- 

  • <b>: change the background color. For example-‘color b1’– changes the background color to blue.

  • <f>: change the background color. For example- ‘color fc’, changes the foreground color to red.

17. COMP

You can use this command to compare two files and capture the differences.

For example- comp [<data1>] [<data2>] [/d] [/a] [/l] [/n=<number>] [/c]

18. FIND/FINDSTR

You can use this command to search ASCII files for any strings.

For example- findstr [/b] [/e] [/l | /r] [/s] [/i] [/x] [/v] [/n] [/m] [/o] [/p] [/f:<file>] [/c:<string>] [/g:<file>] [/d:<dirlist>] [/a:<colorattribute>] [/off[line]] <strings> [<drive>:][<path>]<filename>[ …]

19. PROMPT

You can use this command to change to another drive from C:\>.

Syntax: prompt [<text>]

Example- prompt –$g In this example, the command will display an arrow (–> ) type.

20. PathPing

This command works similar to the TRACERT command but provides additional information. You will get a detailed analysis of the entire route through which a packet will be sent to a particular destination. You will also get information about the loss of packets at each hop.

Syntax: pathping [/n] [/h <maximumhops>] [/g <hostlist>] [/p <Period>] [/q <numqueries> [/w <timeout>] [/i <IPaddress>] [/4 <IPv4>] [/6 <IPv6>][<targetname>]

21. GETMAC Media Access Control

Media Access Control is a unique address that the manufacturing company assigns to all the devices as per the standards of IEE 802. This MAC address allows the users to control the devices and allow those devices 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 /?

22. NSLOOKUP- Name Server Lookup

Users can use this command to find any domain name’s name server records. You can use the following syntax.

Syntax: nslookup [exit | finger | help | ls | lserver | root | server | set | view] [options]

For example: C:\Users\Username>nslookup

23. NETSH- NETWORK SHELL

You can use this command for collecting the necessary details of network adapters that are available on the system. You can use this command to check and set up the network adapters. You can use the following syntax.

Syntax: netsh [-a <Aliasfile>][-c <Context>][-r <Remotecomputer>][-u [<domainname>\<username>][-p <Password> | [{<NetshCommand> | -f <scriptfile>}]

For example: C:\Users\netsh dump \?

24. ARP

Users can use this command to show, delete, and make additions to ARP information of the devices on the network. Below is the syntax for the command.

Syntax: arp [/a [<inetaddr>] [/n <ifaceaddr>]] [/g [<inetaddr>] [-n <ifaceaddr>]] [/d <inetaddr> [<ifaceaddr>]] [/s <inetaddr> <etheraddr> [<ifaceaddr>]]

25. NBTSTAT

This command uses NBT for resolving the issues related to NETBIOS name resolution. You can use this command to check and set up the network adapters. Syntax to collect to use this command to show all the current protocol statistics and current TCP/IP connections. This command uses NBT for resolving the issues related to NETBIOS name resolution. You can use the following syntax.

Syntax: nbtstat [/a <remotename>] [/A <IPaddress>] [/c] [/n] [/r] [/R] [/RR] [/s] [/S] [<interval>]

Example: C:\Users\nbtstat

26. Finger

You can use this command to gather information about a particular user. You can use the following syntax to get all the information related to the last login, last read time for emails, etc.

Syntax: finger [-l] [<user>] [@<host>] […]

Example: finger @ host: The host is the server on the remote system from which user information is required.

27. Hostname

You can use this command to get the hostname of the computer. Below is the syntax for this command.

Syntax: hostname

Example: C:\Users\hostname

28. Net

The user can use this command to see and get the details of the network settings and update and fix the network-related issues. You can use the following syntax.

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]

29. Route

Users can use this command to check and tweak the routing table within your system. You can use the following syntax.

Syntax: route [-f] [-p] [-4|-6] command [destination] [MASK netmask] [gateway] [METRIC metric] [IF interface]

For example: C:\Users\route. PRINT

30. WHOIS

Users can use this command to get information about the domain name or the IP address. Running this command will go through the WHOIS database for accessing the objects. Below is the syntax for this command.

Syntax: whois [ -h HOST ] [ -p PORT ] [ -aCFHlLMmrRSVx ] [ -g SOURCE:FIRST-LAST ]

[ -i ATTR ] [ -S SOURCE ] [ -T TYPE ] object

For example, whois [-h]

You will require admin access to execute this command. 

31. Command History

Users can use this command to recall commands that have been executed recently.

Trick: doskey/history

32. Run multiple commands

Running multiple commands will be time-saving. You need to use “&&” between the two commands.

 For example: assoc.txt && IPCONFIG

Windows command-prompt commands are handy for everyone who wants to perform day-to-day tasks. It will be time-saving to manage every task from a single interface. Hundreds of commands will help you in every aspect of the system, such as installing software, downloading applications, connecting to a remote server, data transmission among servers, and many more tasks. You can even schedule tasks to reduce the manual effort, which can also be done via a command prompt.

It is a versatile feature of the Windows system. Well, we have only covered the most commonly used Windows commands. But this is not the end; you will come across several commands to serve your different purposes.

Susith Nonis

I'm fascinated by the IT world and how the 1's and 0's work. While I veture into the world of Technology I try to share what I know in the simplest way possible. Not a fan of coffee, a sweet addict and a self accredited 'master chef'.