in

15 Windows Command Prompt Commands to Know as Sysadmin

default image

The Windows command prompt allows system administrators to perform many unique tasks that can‘t be done through the graphical user interface. Mastering these commands is essential for effectively managing Windows systems and networks.

In this comprehensive guide, I‘ll share 15 of the most useful Command Prompt commands for system administrators. Whether you need to troubleshoot network issues, manage hardware devices, or automate remote management tasks, these commands have you covered.

An Introduction to the Command Prompt

The Command Prompt (cmd.exe) is a command-line interface available in all versions of Windows. It allows you to run text-based commands to do just about anything you can do with the graphical Windows interface.

Some key benefits of using the Command Prompt include:

  • Automating repetitive tasks by scripting commands
  • Performing advanced troubleshooting and network diagnostics
  • Managing files and directories on local or remote systems
  • Configuring system settings that can‘t be accessed graphically
  • Running commands on multiple systems simultaneously via batch files

To open the Command Prompt, press Windows+R and type cmd then hit Enter. For administrator access, search for cmd.exe, right-click it, and select Run as Administrator.

Now let‘s look at 15 essential commands for Windows system administrators.

1. ipconfig

The ipconfig command displays detailed IP address information for your computer and network connections.

Some common uses for ipconfig include:

  • Viewing your current IP address, subnet mask, default gateway, and DNS server
  • Confirming DHCP is enabled and working properly
  • Identifying network connection issues like duplicate IP addresses
  • Releasing and renewing your IP address to re-establish a connection

To see your full network configuration, run:

ipconfig /all

This will show your MAC address, DHCP server, WINS servers, NetBIOS details, and more.

For other usage examples, refer to Microsoft‘s ipconfig documentation.

2. tracert

The tracert command analyzes the route over a network between your computer and a specified destination. This allows you to identify connection issues along the route.

Tracert works by sending ICMP echo request packets to each router between you and the destination, and listing how long each hop takes.

Key uses for tracert include:

  • Determining the path taken to reach a destination IP or hostname
  • Measuring network latency at each stage along the route
  • Identifying any failed hops which may be causing connectivity issues

To trace the route to example.com, run:

tracert example.com

Learn more about tracert parameters in Microsoft‘s documentation.

3. driverquery

The driverquery command lists all device drivers installed on your system. This helps you inspect and troubleshoot driver-related issues.

Running driverquery with no parameters will show all drivers, their start type (automatic vs manual), and the date they were installed.

You can filter the output to show specific devices, providers, or date ranges. For example:

driverquery /FI "PROVIDER eq ‘Microsoft‘"

This command shows only Microsoft-provided drivers.

See Microsoft‘s driverquery doc for additional usage examples.

4. systeminfo

The systeminfo command shows detailed configuration information about a computer and its Windows operating system.

Information displayed includes:

  • OS name, version, build, and install date
  • System manufacturer and model
  • Total RAM and disk space
  • System boot time, timezone, and domain/workgroup
  • Windows directory and system paths

Simply running systeminfo will provide a quick system overview. You can use parameters like /FO CSV to output details in CSV format for easy analysis.

Check out Microsoft‘s systeminfo examples for more usage tips.

5. powercfg

The powercfg command lets you manage power settings and analyze power usage from the Command Prompt.

Key uses of powercfg include:

  • Importing or exporting power plans to quickly configure settings
  • Generating power efficiency reports to identify issues
  • Modifying advanced power settings not available graphically
  • Tracking wake source history to find unwanted wake events

For example, to generate a power usage report in HTML format:

powercfg /ENERGY /OUTPUT %USERPROFILE%\report.html

Refer to Microsoft‘s powercfg doc for detailed usage guidance.

6. sfc

sfc (System File Checker) scans Windows system files and replaces corrupted files from a known good cache. This helps repair OS file damage.

The most common usage is:

sfc /scannow

This runs an immediate scan of your system files and automatically repairs any integrity violations.

You can also scan specific folders with /VERIFYONLY to get a report of issues without applying repairs.

Learn more ways to use sfc from Microsoft‘s sfc doc.

7. chkdsk

The chkdsk command checks volumes for file system errors and logical issues. It can fix many errors automatically.

A common usage is:

chkdsk C: /f

This runs a check on C: drive and fixes any file system problems found.

You can also use various switches like /R for more advanced repair, or /SCAN for a read-only scan.

Refer to Microsoft‘s chkdsk doc for more usage details.

8. netstat

The netstat command displays network connections, routing tables, interface statistics, and more. This makes it invaluable for network troubleshooting.

Some key uses include:

  • Listing active TCP and UDP connections and associated programs
  • Displaying Ethernet-level statistics for packets/bytes sent/received
  • Viewing the routing table to analyze gateway configuration
  • Identifying listening TCP and UDP ports and associated processes

For example, to show active connections:

netstat -ano

See Microsoft‘s netstat examples for additional usage guidance.

9. tasklist

The tasklist command displays a list of applications and services currently running on a system. You can use it to view process details.

Running a simple tasklist will show all running processes, their PID, memory usage, and executable path.

You can filter the output by parameters like application name, PID, or CPU/memory usage. For example:

tasklist /FI "MEMORY >100"

Shows processes using over 100 MB of memory.

Refer to Microsoft‘s tasklist doc for more filter examples.

10. getmac

The getmac command shows the media access control (MAC) address of your network adapters or remote computers.

Running getmac without parameters will show your own MAC addresses.

You can specify a computer name or IP address to view the MAC address of remote PCs. For example:

getmac /s 192.168.1.100

See Microsoft‘s getmac examples for additional usage guidance.

11. shutdown

The shutdown command allows you to shut down, restart, or log off the local system or remote computers.

For example, to restart the current system after a 60 second delay:

shutdown /r /t 60

You can shut down remote systems by specifying a system name or IP address. For example:

shutdown /s /m \\Server01 /t 0 

This shuts down Server01 immediately without any delay.

Refer to Microsoft‘s shutdown doc for more usage examples.

12. assoc

The assoc command displays or modifies file extension associations. This allows you to manage what programs open various file types.

Running assoc by itself will show all registered extensions and their associated programs.

You can change an association by specifying the extension and program path. For example:

assoc .txt=notepad.exe

Now .txt files will open with Notepad rather than the default program.

See Microsoft‘s assoc examples for more usage details.

13. robocopy

The robocopy command copies files extremely fast while allowing you to fine-tune the copy process. This makes it a flexible tool for file management.

A basic robocopy command looks like:

robocopy C:\Source D:\Destination *.txt 

This copies all .txt files from C:\Source to D:\Destination

You can use dozens of parameters to control aspects like multi-threading, restartability, subfolders, file attributes, and more.

Refer to Microsoft‘s robocopy doc for all available options.

14. format

The format command formats a drive by deleting its file system and creating a new blank one.

For example, to quick format drive E: to NTFS:

format E: /FS:NTFS /Q

The /Q performs a quick format.

You can also specify file system options like cluster size, compression, and custom volume labels.

See Microsoft‘s format examples for additional usage guidance.

15. hostname

The hostname command displays the name of your local computer. You can also use it to modify the hostname.

Simply running hostname prints your current hostname.

You can change the hostname like this:

hostname NEW-HOSTNAME

This takes effect immediately but requires a restart to fully apply.

There are no additional parameters for hostname. It‘s a simple but useful command.

Conclusion

In this guide, I‘ve covered 15 of the most essential Windows Command Prompt commands for IT professionals to know. Mastering these commands will allow you to effectively manage Windows networks and systems from the command line.

The Command Prompt is a powerful tool all system administrators should have in their toolkit. With robust commands for troubleshooting, automation, and remote management, it enables you to perform critical tasks quickly and efficiently.

I hope this overview gives you a solid foundation to start harnessing the capabilities of the Windows Command Prompt. Let me know in the comments if you have any other favorite commands I should cover in the future!

AlexisKestler

Written by Alexis Kestler

A female web designer and programmer - Now is a 36-year IT professional with over 15 years of experience living in NorCal. I enjoy keeping my feet wet in the world of technology through reading, working, and researching topics that pique my interest.