Best Command Prompt Hacks
TL;DR: Command Prompt hacks are shortcuts, hidden functions, and practical commands that help you manage a Windows PC faster, without digging through menus or installing third-party tools.

Command Prompt often gets overlooked in favor of flashier tools, but it remains one of the fastest ways to manage a Windows PC. A few keyboard shortcuts and commands can save you from digging through menus, whether you're launching CMD directly from a folder, renaming a tab for clarity, or customizing how the prompt itself looks. These small tweaks add up when you work across multiple windows or repeat the same tasks daily.

Beyond convenience, CMD is also a practical first stop for troubleshooting. Commands like ipconfig, ping, and tracert help you diagnose network issues, while netstat and arp -a offer a quick way to check for suspicious activity on your system. Add in system repair commands like sfc /scannow, and you have a lightweight toolkit for handling everyday computer problems, no third-party software required.

Quick Reference: Commands At a Glance

Command

What it does

Example

Admin required?

ipconfig

Displays network configuration

ipconfig /all

No

ping

Tests connectivity

ping google.com

No

tracert

Traces the route to a host

tracert google.com

No

nslookup

Checks DNS resolution

nslookup google.com

No

netstat

Shows active connections and listening ports

netstat -ano

Usually no

tasklist

Lists running processes

tasklist

No

taskkill

Ends a process

taskkill /IM chrome.exe /F

Usually no

shutdown

Shuts down, restarts, or cancels a shutdown

shutdown /r /t 60

Usually no

systeminfo

Displays detailed system information

systeminfo

Usually no

sfc

Scans and repairs protected system files

sfc /scannow

Yes

DISM

Repairs the Windows system image

DISM /Online /Cleanup-Image /RestoreHealth

Yes

chkdsk

Checks a drive for file system errors

chkdsk C: /f

Yes

arp

Shows the local ARP cache

arp -a

No

cipher

Overwrites free disk space

cipher /w:C

Usually yes

robocopy

Advanced file copying

robocopy C:\Source C:\Destination /E

Usually no

powercfg

Generates a battery report

powercfg /batteryreport

No

Cyber Security Expert Master's ProgramLearn Now
Master In-Demand Cyber Security Skills!

Quick CMD Tricks

1. Open File Explorer and go to the folder you want to work in.

2. Click the address bar, type cmd, and press Enter. CMD opens directly in that folder, no menu-digging needed.

Open CMD

3. To run CMD with administrator rights (needed for commands like sfc and chkdsk), search for Command Prompt in the Start menu, right-click it, and select "Run as administrator."

4. Type title YourName and press Enter to rename the CMD tab, useful when you have multiple CMD windows open and want to tell them apart.

Title of the Command Prompt Window

5. Type prompt $G and press Enter to customize the prompt, for example, replacing the default CMD1> with just >.

Change Prompt Text

Beyond a few quick CMD tricks, let's explore essential network commands that help you see and understand your network situation and better troubleshoot common issues like connectivity problems.

Productivity and Shortcut Hacks

A handful of lesser-known shortcuts and small utility commands can save real time once they're part of your routine.

  1. Press Tab while typing a file or folder name to autocomplete it, instead of typing the full path.
  2. Use the Up and Down arrow keys to scroll through your command history instead of retyping recent commands.
  3. Press Ctrl+C to stop a command that's currently running, useful for a long ping or another ongoing process.
  4. Type cls to clear a cluttered screen.
  5. Type help to see a list of available commands, or add /? after any command, like xcopy /?, to see its specific options.
  6. Use doskey /history to see every command you've typed in the current session.
  7. Type start . to open the current folder in File Explorer without leaving CMD.
  8. Pipe long output through more, for example, dir /s | more, to read it one page at a time instead of it scrolling past.
  9. Use where python to find the full path to an executable in your system PATH.
  10. Use whoami to see which user account you're currently logged in as.
  11. Use hostname to see your PC's network name.
  12. Use ver to display your Windows version, useful when troubleshooting version-specific issues.
  13. Use findstr to search for text within files or command output; for example, dir | findstr ".pdf" to find only PDF files.
  14. Use robocopy as a more capable alternative to copy for bulk file transfers, with retry and logging options, for example, robocopy C:\Source C:\Destination /E.
  15. Use powercfg /batteryreport to generate an HTML report on a laptop's battery health and usage history.
  16. Use chkdsk C: /f (run as administrator) to scan a drive for file system errors.
  17. Use ipconfig /flushdns to clear your DNS cache, which can fix issues where you're being sent to an old or wrong IP address for a site.
  18. Use shutdown /a to cancel a scheduled shutdown or restart before it happens.
  19. Use color (for example, color 0A) to change the CMD window's text and background colors.
  20. Use mode con: cols=100 lines=30 to resize the CMD window.
  21. Type start https://example.com to open a website in your default browser directly from CMD.
  22. Use mkdir foldername to create a new folder, move file.txt C:\NewFolder to move a file, ren oldname.txt newname.txt to rename one, and rmdir foldername to delete an empty folder.
  23. Use command > output.txt to save a command's output to a text file, overwriting it each time, or command >> output.txt to append to it instead. For example, systeminfo > system-report.txt saves a full system report you can open later.

Find Your IP Address With ipconfig

Type ipconfig and press Enter to view your PC's IP address configuration. This shows your subnet mask, default gateway, and IP address. If you're having internet issues, try ipconfig /release and ipconfig /renew to renew your IP configuration.

Using the Ping Command to Test the Connection

The ping command tests the connection between your PC and other hosts and web servers. For instance, pinging google.com lets you check for issues with the connection to that site. Ping sends request packets and measures the time it takes to receive a response.

Cyber Security Expert Master's ProgramStart Learning
Get the Skills to Ace a Cybersecurity Interview

Use Tracert to Trace the Route

The tracert command shows the route taken to a specific website. For example, tracert google.com displays the series of hops taken to reach the destination server.

Use nslookup to Check DNS

The nslookup command examines the Domain Name System (DNS). For example, nslookup google.com shows which IP address the domain name resolves to. This helps troubleshoot DNS-related issues.

See Active Connections With netstat

The netstat -an command displays active network connections on your PC, including TCP and UDP ports, remote IP addresses, and the connection state, such as listening or established. This is probably the command you'll use most often to check for suspicious activity, such as a connection to an unknown or malicious IP address you didn't authorize.

You can also use netsh wlan show profile name="WiFiName" key=clear to view a saved WiFi password if you need to reconnect to the network. This command reveals the network's saved password in plain text, so only run it on your own network and device, and be careful who you share the output with. Depending on your Windows configuration, showing the key may require an elevated (administrator) Command Prompt.

You can also chain commands to run them one after another; for example, cd Documents && dir will change the directory to Documents and list its contents. You can also use | to pass the output of one command to another; for example, ipconfig | clip will copy the IP configuration directly to the clipboard.

Advance your skills with the Masters in Cybersecurity, a comprehensive training in network security, penetration testing, and more. Start today and become an in-demand cybersecurity professional. Enroll Now!

Several essential commands let you navigate and manage files day to day. The cd foldername command changes the directory to the specified folder, while cd .. goes back one level. The dir command lists the contents of the current directory; copy file1.txt file2.txt copies one file to another, and del filename deletes a file. If you want to see the entire directory layout, including subfolders, use tree.

Useful System and Process Commands

Beyond navigating the file system and managing files, you can use CMD to manage system processes and perform advanced tasks such as terminating unresponsive applications or restarting your PC.

  • See Running Processes With Tasklist

The tasklist command displays all running processes on your PC, including their process ID, memory consumption, and other relevant details. You can also use tasklist /FI "IMAGENAME eq chrome.exe" to see whether a specific application is running, which helps when you need to terminate a faulty or unresponsive process.

  • End a Process With Taskkill

The taskkill command terminates processes. For example, taskkill /IM chrome.exe /F terminates the Google Chrome browser process. This is useful if an application freezes and you need to end the task to regain control of your PC.

  • Shut Down or Restart Your PC From CMD

The shutdown command lets you shut down or restart your PC. For example, shutdown /s /t 0 powers off your PC immediately, while shutdown /r /t 0 reboots it. You can also schedule a shutdown or restart with the /t parameter and the number of seconds before the action occurs, and cancel it with shutdown /a if you change your mind.

  • Get Full System Information With systeminfo

The systeminfo command provides detailed information about your PC, such as the operating system version, install date, BIOS version, installed memory, and more. This is a convenient way to get a summary of your system configuration without going through the Control Panel or Settings app.

CompTIA Security+ Certification - SY0-701Explore Program
Learn the Most In-Demand Skills!

Command Prompt for Basic Cybersecurity Checks

Some of the commands described above can also be used for basic cybersecurity checks as a way to quickly assess certain aspects of network security before turning to more specialized tools such as Wireshark or Nmap:

  • Examine suspicious connections: netstat -an (described above) displays connections on your PC, including inbound and outbound. Any connection to an unknown or potentially malicious IP address may be a security concern.
  • Check your ARP cache: arp -a shows the IP-to-MAC address mappings currently cached on your machine for devices it has recently communicated with, not a full scan of everyone on your network. Unusual or duplicate MAC addresses in this list can be worth investigating further, though the command alone can't confirm an ARP spoofing attack.
  • Reduce recoverable deleted data: cipher /w:C overwrites free space on drive C with random data, which removes recoverable remnants of previously deleted files from that space. It does not affect files that are still active, and on some storage types, particularly SSDs, wear-leveling and TRIM can mean data isn't fully unrecoverable even after this. This command is for diagnostic and security purposes only, and using it on other systems without permission may be illegal.

Windows Repair Commands

Some essential system repair commands help fix common system issues:

sfc /scannow

This command scans the system for integrity issues and attempts to repair them using the Windows repair database. It helps fix common issues such as application crashes, system instability, and malfunctioning features. This command should be executed as administrator.

DISM /Online /Cleanup-Image /RestoreHealth

This command performs a similar function to the one above but scans the primary operating system image for issues and attempts to repair them. In some cases, it may also download the necessary system files over the network. Use this command if sfc fails to resolve the issue or doesn't provide enough information.

Note: Many of the commands above, including taskkill, shutdown, sfc, and cipher, require or work best when executed as administrator. To run them as administrator, right-click Command Prompt and select "Run as administrator." If you get an "access denied" error, it is most likely due to insufficient permissions.

The step-by-step Security Engineer Roadmap is designed for professionals seeking to understand the full scope of the profession. Explore the skills, tools, salary potential, and career roadmap needed to build a successful career in cybersecurity.

Key Takeaways

  • A handful of CMD commands can replace several minutes of menu-clicking with a few seconds of typing, especially for repeated tasks like checking your IP address, killing a frozen process, or restarting your PC.
  • Small CMD hacks make daily computer tasks easier, from faster file management to running quick diagnostics without opening a single menu.
  • Network, system information, and repair commands let you quickly troubleshoot common issues, such as internet connectivity or system stability, without relying on external tools.
  • You can also use several commands above for basic cybersecurity checks, such as checking for suspicious connections, unusual ARP entries, or reducing recoverable deleted data on free disk space.
  • Avoid using Command Prompt for hacking; it's meant only for troubleshooting, learning, and other legal activities.

FAQs

1. Is it legal to use the Command Prompt hacks covered here? 

If you're an ordinary user, use these only on your own computer. If you're a system administrator, use them only on computers you're authorized to work with. Using CMD tricks on someone else's PC without permission may be illegal.

2. What's the difference between CMD and PowerShell? 

PowerShell is built on the .NET Framework and offers more advanced scripting, automation, and object-based output than CMD, a simpler, older command-line interpreter. CMD is still useful for quick, familiar commands, but PowerShell is generally the better choice for complex scripting tasks.

3. How do I find which program is using a port (netstat)? 

Use netstat -ano to view active ports and process IDs, then match the port to the process in Task Manager.

4. Can CMD improve computer performance?

Indirectly. Commands like sfc /scannow and DISM can fix corrupted system files that cause slowdowns or crashes, and ipconfig /flushdns can resolve some network-related slowness. CMD isn't a performance tool on its own, but it can fix specific issues that are dragging performance down.

5. How do I undo a Command Prompt command? 

CMD doesn't have a universal undo. For file operations, check the Recycle Bin first; del bypasses it for some file types, so deleted files may not be recoverable. For system changes made by sfc or DISM, there's no direct undo, which is why it's worth understanding what a command does before running it.

6. What's the difference between CMD and Windows Terminal? 

Windows Terminal is a modern app that can host multiple shells, including Command Prompt, PowerShell, and WSL, in tabs within one window. CMD itself is one of the shells you can run inside it. If you're on Windows 11, Windows Terminal is usually the default when you search for "cmd," though the underlying Command Prompt commands work the same either way.

About the Author

Anmol KapoorAnmol Kapoor

Anmol is a Research Analyst who aims to become a Data Scientist one day. He enjoys Data Management systems and analysis. You will find him reading a book when he is not working.

View More
  • Acknowledgement
  • PMP, PMI, PMBOK, CAPM, PgMP, PfMP, ACP, PBA, RMP, SP, OPM3 and the PMI ATP seal are the registered marks of the Project Management Institute, Inc.
  • *All trademarks are the property of their respective owners and their inclusion does not imply endorsement or affiliation.
  • Career Impact Results vary based on experience and numerous factors.