Heimdal
article featured image

Contents:

Windows’ celebrated CLI (Command-Line Interpreter) is a treasure trove of hidden features, tools, and settings.

Command Prompt lets you tap into every area of your Operating System, from creating new folders to formatting internal and external storage.

To help you navigate cmd.exe like a pro, we’ve prepared a compressive list of cool CMD commands to make you feel like a hacker.

Getting Started with Command Prompt

Unsure about using cmd.exe? Not a problem; just follow this step-by-step guide to get started.

First of all, you’ll need to fire up the Command Prompt Window by hitting Windows Key + R and typing in cmd in the Run window. Hit Enter and CMD will momentarily pop up on your screen.

There’s more than one way to prompt command.

For the second method, hit the Windows key to bring up the Start Menu. After that, type in cmd or command prompt in the search bar and left-click on the icon.

To sum up…

Method 1: Windows key + R -> type cmd -> press Enter

Method 2: Windows key -> type cmd or command prompt -> left-click on the CMD icon.

Now that Command Prompt is up and running, it’s time to have some fun. We’re going to start with a couple of basic commands and then move on to the more advanced stuff.

Basic Windows CMD Commands

  1. Verdisplays operating system version on the screen (e.g., Microsoft Windows [Version 10.0.19045.2486])
  2. Datedisplays the current date on the screen. Can also be used to change the date.
  3. Shutdownshuts down your machine.
  4. Taskkillallows you to terminate a process or a running app. To use this, type in taskkill followed by ‘/f’, ‘/im’, and the name of the process or app you want to terminate (e.g. winword.exe). So, if we want to kill all instances of MS Word, we would need to type in taskkill /f /im winword.exe. Hit Enter to confirm.
  5. Colorchanges the color of the foreground and background. For instance, typing in ‘color fc’ will make the background bright white and the foreground (i.e., writing) light red.
  6. Getmac displays your machine’s MAC address.
  7. Ipconfig displays your IP address.
  8. Ping sends data packets to a specific IP address or network (e.g., ping google.com). Very useful in troubleshooting Internet connectivity issues.
  9. Pathpingmaps the connection to a specific IP address. Can also be used to troubleshoot connectivity issues.
  10. Nslookup displays the DNS record or IP address of a specific domain (e.g., nslookup facebook.com).
  11. Chkdksperforms a routine check on a specified disk and corrects errors.
  12. Gpupdateupdates group policies. Usually used in conjunction with the force (/f) argument.
  13. Mkdircreates a new directory.
  14. Tasklistdisplays a list of all live processes and applications.
  15. Timeout very useful when working with batch files. This command allows you to delay execution for a specified number of seconds. When appended the -1 value, process execution will be delayed indefinitely. The computer will wait for a keystroke to continue.
  16. Type – this command allows you to view text files (.txt) in your cmd window.
  17. Vol displays disk volume information such as serial numbers or labels.
  18. Systeminfo – displays useful sys info such as Host Name, OS version, processor, BIOS version, time zone, applied hotfixes, and more.
  19. Netstat ­– displays info about active TCP connections.
  20. Help – outputs a list of commonly used commands.

Advanced Windows CMD Commands

And now it’s time to lose the kid gloves and talk about some more advanced (and cool) CMD commands.

  1. Telnetallows you to establish a remote, Telnet-type connection.Before attempting to ‘dial’, ensure that both machines support Telnet communication and that the client software is installed.To initiate this type of remote session, you must specify the IP address of the server or the main computer followed by 13531 (e.g. telnet 60.227.102.16 13531). The number at the far end of the command represents the communication port used by the Sage 50 Connection Manager.If the setup’s done right, your CMD cursor should become blank. Otherwise, it will return the message “telnet is not recognized as an internal or external command, operable program, or batch file”. This error message appears when Telnet’s not enabled on the machine.To switch it on, click on the Start button and head to Control Panel. Under Programs and Features, select Turn Windows Features on or off.Scroll down until you see Telnet Client and Telnet Server. Enable both features and click the Ok button to confirm. Restart your machine. Open a new CMD window and retry the connection.
  2. Klistthis command allows you to visualize cached Kerberos tickets and retrieve useful information such as encryption type, server, start time, renew time, session key type, cached flags, and more.
  3. FC changes made to files may not always be obvious.To see if a file has been modified, use the File Compare (FC) command in CMD. You can perform two kinds of file comparisons: ASCII or binary.For instance, you may want to use an ASCII-type comparison when working with a text file. On the other hand, for media (e.g. pictures, clips, etc.) a binary comparison would be the proper approach.
  4. Powercfg – this is a great diagnostic tool for laptop users.Ever wondered why your battery’s running out so fast, leaving you high and dry, possibly in the middle of an (important) e-meeting? Well, you can quickly find out by running this Power Configuration utility in CMD. Powercfg usually works best with the ‘-energy’ argument.So, after running the combo ‘powercfg -energy’, your machine will begin a 60-second power test. It will generate a power efficiency diagnostic report. If any errors are found, they will be highlighted in the second section of the report, along with recommendations.
  5. Caclsthis nifty command allows you to display or modify ACLs (i.e. Access Control Lists) of various files.Some of its more popular uses include granting specific access rights to users (i.e. Read, Write, Change, or Full Control), revoking permissions, denying specific users, or replacing the user’s access rights. Here’s a quick example of how to use the Cacls command.

Step 1. Create a text document on your desktop area. Name it ‘test.txt’

Step 2. Open CMD.

Step 3. Navigate to the Desktop directory by typing in ‘cd desktop’

Step 4. Type in ‘cacls test.txt’. This will display users and permissions.

Step 5. In this example, we will update (replace) the default rights of user BUILTIN\Administrators from F (i.e. Full Control) to R (i.e. Read only) using the /P argument.

Step 6. Type in ‘cacls test.txt /P BUILTIN\Administrators: R

Step 7. Type ‘Y’ and press Enter to confirm changes.

6. ARPdisplay or commit changes to the ARP cache.

To view the contents of the cache, type in ARP -a and press ENTER. If you want to make changes to the ARP cache such as adding a static entry use ARP-a, followed by the Internet address (i.e. IP) and the physical address (i.e. MAC).

For instance, if we have a new host and want to associate its IP to its physical address, we will need to type in the following line: ARP-a [IP_address] [Physical_Adress].

7. Chgport – use this command to display or remap COM ports.

8. Cipher ­– check the encryption status of your files or folders (i.e., NTFS partitions only).

9. Cmdkey – displays and allows you to make modifications to all host-stored passwords and usernames.

10 Dispdiag – allows you to diagnose display-related issues. Can create log dump files when used together with the [-d] argument.

11. Driverquery – displays a list of all the drivers installed on the machine.

12. Fondue – install optional MS Windows updates from CMD.

13. Hwrcomp – this command allows you to install or update existing handwriting recognition dictionaries.

14. Makecab – used to compress files and folders.

15. Mrinfodisplays router interface info.

16. Pentnt – this command allows to user to detect so-called floating-point division errors in Pentium processors.

17. Reagentc – use this command to configure the Windows Recovery Environment.

18. Recover – retrieve data from a bad disk.

19. Repair-bde – useful in decrypting/repairing a damaged drive that’s been encrypted with BitLocker.

20. Runas – execute an application with another user’s credentials.

21. Chgusr – modify the install mode for your terminal server.

22. Cmstp –  used to install or uninstall a service profile for the Connection Manager.

23. Ctty – modify the default input or output devices.

24. Forfiles – Selects and executes a command on a file or set of files.

25. Format – Prepares a disk for use with Windows, by formatting it.

26. Fsutil – Performs tasks related to file allocation table (FAT) and NTFS file system, such as managing reparse points or sparse files.

27. Ftp – Transfers files to and from a remote network site using the File Transfer Protocol.

28. Getmac – Displays the Media Access Control (MAC) address for network adapters.

29. Goto – Directs the Command Prompt to a labeled line in a batch program.

30. Gpresult – Displays Group Policy information for a machine or user.

31. Gpupdate Refreshes local and Active Directory-based Group Policy settings, including security settings.

32. Graftabl – Enables the ability to display an extended character set in graphics mode.

33. Hostname – Displays the host name portion of the full computer name of the computer.

34. Icacls – Displays or modifies discretionary access control lists (DACLs) on specified files.

35. If – Performs conditional processing in batch programs.

36. Ipconfig – Displays all current TCP/IP network configuration values and refreshes Dynamic Host Configuration Protocol (DHCP) and Domain Name System (DNS) settings.

37. Iscsicli – Starts the Microsoft iSCSI Initiator, used to manage iSCSI.

38. Klist – Displays or deletes Kerberos tickets.

39. Ktmutil – Starts Kernel Transaction Manager Utility.

40. Label – Creates, changes, or deletes the volume label of a disk.

41. Lodctr – Updates registry values related to performance counters.

42. Logman – Manages and schedules performance counter and event trace log collections on local and remote systems.

Did you get the cool CMD commands you wanted?

I’m always open to getting feedback. If you enjoyed the article or feel we’re missing anything, let me know by reaching out to us on social media. It’s a relatively short list of CMD commands but enough to show you what’s possible.

Don’t forget to stay safe.

If you liked this article, follow us on LinkedInTwitterFacebookYouTube, and Instagram for more cybersecurity news and topics.

Author Profile

Vladimir Unterfingher

Senior PR & Communications Officer

Experienced blogger with a strong focus on technology, currently advancing towards a career in IT Security Analysis. I possess a keen interest in exploring and understanding the intricacies of malware, Advanced Persistent Threats (APTs), and various cybersecurity challenges. My dedication to continuous learning fuels my passion for delving into the complexities of the cyber world.

CHECK OUR SUITE OF 11 CYBERSECURITY SOLUTIONS

SEE MORE