Jump to content
  • 20 Essential commands every user should know on Command Prompt for Windows 11

    Karlston

    • 1 comment
    • 677 views
    • 12 minutes
     Share


    • 1 comment
    • 677 views
    • 12 minutes

    These are the most basic commands you have to know on Windows 11.

    Although Command Prompt has been around for a long time, even before Windows 11, many users still ignore it. While the operating system's modern graphical interface seamlessly handles virtually every task, Command Prompt offers unparalleled control, efficiency, and troubleshooting capabilities.

     

    Whether you're looking to navigate your file system faster, diagnose network issues, or perform administrative tasks efficiently, mastering the essential commands can save you time and effort.

     

    In this how-to guide, I'll highlight 20 essential commands to manage files, troubleshoot issues, and perform various system-level tasks on Windows 11. These commands will also work on Windows 10.

    Command Prompt essential commands for Windows 11

    This list includes the most basic commands that any user should know. The list isn't arranged in any specific order.

     

    To use these commands, open Start and search for and launch the Windows Terminal and then launch a Command Prompt console (if applicable).

    1. cd (Change Directory)

    The "cd" command, short for "change directory," is a fundamental command-line tool to move between different folders (directories) and switch between drives (like C:, D:, etc.).

     

    Usage:

     
    • cd DIRECTORY-NAME
    • Example: cd C:\Users\YourName – Moves to your account folder.

     

    Command Prompt cd command

    (Image credit: Mauro Huculak)

     

    Replace "directory-name" with the name and path of the folder you want to navigate.

     

    Special cases:

     

    • cd .. Moves you one level "up" in the directory tree (to the parent folder).
    • cd \ Takes you to the root directory of the current drive (for example, C:\).
    • cd / – (In some systems) Also takes you to the root directory.

    2. dir (Directory)

    The "dir" command in the Command Prompt is a tool for viewing the contents of a directory (folder).

     

    Usage:

     

    • dir – This command alone lists the contents of the current location.
    • Example 1: dir /P – Lists the contents of the current directory, pausing after each screenful.
    • Example 2: dir /AH – Lists all hidden files in the current directory.

     

    Command Prompt dir command

    (Image credit: Mauro Huculak)

     

    Special cases:

     

    • /P: Pauses the output after each screenful, allowing you to read it more easily.
    • /W: Displays the output in a wide format, showing more files per line.
    • /A: Displays files with specific attributes. For example, /A:D shows directories only, /A:H shows hidden files, /A:R shows read-only files, and /A:S displays system files.
    • /O: Sorts the output by various criteria. For example, /O:N sorts by name (alphabetical), /O:D sorts by date/time, and /O:S sorts by size.
    • /S: Displays a list of all files and subdirectories in the specified directory and all subdirectories below it.

    3. mkdir (Make Directory)

    The "mkdir" command allows you to create new directories on a specific location.

     

    Usage:

     

    • mkdir DIRECTORY-NAME
    • Example 1: mkdir "My_Files" – This will create a new folder named "My Files" in the current directory.
    • Emaple 2: mkdir "C:\Users\YourName\Documents\My_Projects" – This creates the "My_Projects" folder inside the "Documents" folder.

     

    Command Prompt mkdir command

    (Image credit: Mauro Huculak)

    4. rmdir (Remove Directory)

    The "rmdir" command allows you to delete empty directories.

     

    Usage:

     

    • rmdir DIRCTORY-NAME
    • Example 1: rmdir "My_Files" – This will delete the folder named "My_Files" if it is empty.
    • Example 2: rd /s /q "My_Files" – This will delete the folder named "My_Files" and its content.

     

    Command Prompt rmdir command

    (Image credit: Mauro Huculak)

     

    It's important to note that rmdir can only delete empty directories. If a directory contains any files or subfolders, the command will fail.

     

    If you want to delete a directory that is not empty, you'll need to use the rd /s /q command. However, be extremely cautious with this command, as it'll delete the directory and all its contents without prompting for confirmation.

    5. copy

    The "copy" command allows you to copy files from one location to another.

     

    Usage:

     

    • copy SOURCE/PATH DESTINATION/PATH
    • Example 1: copy file1.txt C:\Backup – This will copy a file named "file1.txt" from the current directory to the "Backup" folder on the 😄 drive.
    • Example 2: copy *.jpg C:\Backup – This will copy all files with the ".jpg" extension from the current directory to the "Backup" folder.
    • Example 3: copy D:\My_Files\Report.docx C:\Users\YourName\Documents – This will copy the file from the source to the destination location.
    • Example 4: copy file1.txt C:\Backup /Y This will copy the file from the source, overwriting existing files in the destination.

     

    Command Prompt copy command

    (Image credit: Mauro Huculak)

    6. del (Delete)

    The "del" command allows you to delete files (not directories).

     

    Usage:

     

    • del FILENAME
    • Example 1: del file1.txtThis will delete the file named "my_file.txt" from the current directory.
    • Example 2: del *.jpgThis will delete all files with the ".jpg" extension in the current directory.
    • Example 3: del *.jpg /f This can be used to force the deletion of read-only files.

     

    Command Prompt del command

    (Image credit: Mauro Huculak)

     

    It's important to note that once you delete a file, it is typically permanently removed, skipping the Recycle Bin.

    7. ren (Rename)

    The "ren" command allows you to rename files or folders.

     

    Usage:

     

    • ren OLD_FILENAME NEW_FILENAME
    • Example 1: ren old_file.txt new_file.txt This will rename the file "old_file.txt" to "new_file.txt".
    • Example 2: ren "old_folder" "new_folder" – This will rename the folder "old_folder" to "new_folder."

     

    Command Prompt ren command

    (Image credit: Mauro Huculak)

    8. cls (Clear Screen)

    The "cls" command clears the screen contents, making the Command Prompt easier to read, especially after a long series of commands or output.

     

    Usage:

     

    • cls

     

    Command Prompt cls command

    (Image credit: Mauro Huculak)

    9. ipconfig (Internet Protocol Configuration)

    The "ipconfig" command is a useful tool for understanding and managing your computer's network connections. It's an essential command for basic network troubleshooting and more advanced network configuration tasks.

     

    Usage:

     

    • ipconfig

     

    Command Prompt ipconfig command

    (Image credit: Mauro Huculak)

     

    The command outputs essential network information, for example:

     

    • IP Address: Your computer's unique identifier on the network.
    • Subnet Mask: Defines the network segment your computer belongs to.
    • Default Gateway: The address of your router (or modem).
    • DNS Server: The address of the Domain Name System server that translates domain names (like google.com) into IP addresses.

     

    Alternative usage:

     

    Type ipconfig /all and press Enter to display a more detailed view, including:

     

    • MAC Address (Physical Address): A unique hardware identifier for your network adapter.
    • DHCP Server: If your IP address is assigned by a DHCP server, this shows the server's address.
    • DNS Server addresses.

     

    Special cases:

     

    • ipconfig /release: Releases the IP address configuration obtained from a DHCP server.
    • ipconfig /renew: Requests a new IP address configuration from the DHCP server.
    • ipconfig /flushdns: Clears the DNS resolver cache store on your computer when troubleshooting DNS name resolution problems.

     

    Usually, if you want to renew the network configuration, you would first run the ipconfig /release and then the ipconfig /renew command.

    10. ping

    The "ping" command is a simple tool for quickly checking network connectivity and diagnosing basic network problems.

     

    The tool sends small data packets (called "echo requests") to a specified destination (an IP address or domain name) and displays the response (an "echo reply") from the destination.

     

    The time it takes for the packet to be sent, received, and responded to is known as "round-trip time" (RTT).

     

    Usually, you would use this tool to determine if a specific device or server is reachable on the network and troubleshoot other connectivity issues.

     

    Usage:

     

    • ping DNSNAME-OR-IP
    • Example: ping google.com or ping 8.8.8.8 (Google Public DNS server)

     

    Command Prompt ping command

    (Image credit: Mauro Huculak)

     

    If the ping is completed successfully, the command will output the IP address of the destination, show the round-trip time for each packet, and indicate successful replies.

     

    If the command isn't completed successfully, the output will display as "Request timed out."

    11. tracert (Trace Route)

    The "tracert" command (short for "traceroute") is a network diagnostic tool that maps the path data packets take to reach a specific destination on the internet.

     

    The tool sends a series of packets to the target destination, each with a "Time-to-Live" (TTL) value initially set to 1. As the packet travels through the network, each router it encounters reduces the TTL by 1. When the TTL reaches 0, the router discards the packet and sends an "ICMP Time Exceeded" message back to the source.

     

    By analyzing these responses, the "tracert" command determines the sequence of routers (or "hops") the packets pass through along the way.

     

    The command output provides a list of routers encountered along the path, showing their IP addresses and the round-trip time (RTT) for each packet to reach the router and return.

     

    Usage:

     

    • tracert google.com

     

    Command Prompt tracert command

    (Image credit: Mauro Huculak)

     

    This command will trace the route to Google's servers, showing the routers involved in the connection.

    12. shutdown

    The "shutdown" command allows you to control your computer's shutdown and restart behavior.

     

    Usage:

     

    • shutdown /s: Shuts down the computer immediately.
    • shutdown /s /t 60: Shuts down the computer after a 60-second delay.
    • shutdown /r: Restarts the computer immediately.
    • shutdown /r /t 30: Restarts the computer after a 30-second delay.
    • shutdown /L: Logs off the current user.
    • shutdown /a: Cancels a pending shutdown or restart.

     

    Command Prompt shutdown command

    (Image credit: Mauro Huculak)

    13. tasklist

    The "tasklist" command is a tool for viewing and managing the processes running on Windows 11. It provides a quick and easy way to get a snapshot of system activity, similar to Task Manager.

     

    Usage:

     

    • tasklist: Shows all processes and details, such as process name, ID, session name, and memory usage.
    • tasklist /V: The verbose option shows more details like priority, user account, and description.
    • tasklist /M MODULE-NAME: Lists all processes currently using the specified module (for example, a DLL file) after changing "MODULE-NAME" in the command.
    • tasklist /SVC: Displays services hosted in each process.
    • tasklist /FI FILTER: Filters the output based on specific criteria (for example, image name, status) when you change "FILTER" in the command.

     

    Command Prompt tasklist command

    (Image credit: Mauro Huculak)

    14. taskkill

    The "taskkill" command allows you to stop running processes. Usually, you would use this command to resolve issues with unresponsive apps and regain control of your system.

     

    Usage:

     

    • taskkill /IM PROCESS-NAME: Ends a specific process by its name.
    • Exmaple: taskkill /IM notepad.exe
    • taskkill /PID PROCESS-ID: Ends a specific process ID.
    • Example: taskkill /PID 1237
    • taskkill /F: forcefully ends the Explorer process.
    • Example: taskkill /F /IM explorer.exe

     

    Command Prompt Taskkill command

    (Image credit: Mauro Huculak)

    15. chkdsk (Check Disk)

    The "chkdsk" command is a tool that scans the system for errors and bad sectors and tries to repair them.

     

    Usage:

     

    • chkdsk /f: fixes errors on the drive.
    • Example: chkdsk 😄 /f – Checks the "C:" drive for errors and attempts to fix them.
    • chkdsk /r: Locates bad sectors and recovers readable information.
    • Example: chkdsk 😄 /r – Checks the "C:" drive for errors, attempts to fix them, and locates bad sectors.
    • chkdsk /x: Disconnects the drive before running the tool.
    • Example: chkdsk 😄 – Checks the "C:" drive for errors but does not attempt to fix them.

     

    Command Prompt chkdsk command

    (Image credit: Mauro Huculak)

     

    Running the Check Disk command can take significant time, especially if you use the "/r" option.

    16. sfc /scannow (System File Checker)

    The "sfc" ( System File Checker) command is a tool that scans for and repairs corrupted system files using the files already available in the local image for the operating system. Usually, you would use this command with .

     

    Usage:

     

    • sfc /scannow

     

    Command Prompt sfc command

    (Image credit: Mauro Huculak)

     

    When you run the command, the tool scans all protected system files on your computer and compares them to a known good copy stored within the local image.

     

    If SFC finds any discrepancies, such as missing or corrupted files, it flags them as issues and attempts to replace them with the correct versions.

    17. help

    The "help" command gives you resources for learning about other commands.

     

    Usage:

     

    • help COMMAND-NAME
    • Example 1: help dir – Shows information about the "dir" command, including its syntax, options, and usage.
    • Example 2: help – Shows a list of commands available for use in Command Prompt.

     

    Command Prompt help command

    (Image credit: Mauro Huculak)

    18. exit

    The "exit" command closes the current command window. You can also exit scripts and batch files running in Command Prompt.

     

    Usage:

     

    • exit

     

    Command Prompt exit command

    (Image credit: Mauro Huculak)

    19. winget (Windows Package Manager)

    The "winget" command, in a nutshell, is a tool that streamlines the process of installing, updating, and managing apps.

     

    The Windows Package Manager is a tool with a lot of options, but there are a few that every user should know to perform basic operations.

     

    Usage:

     

    • winget search APP-NAME
    • Example: winget search firefox – Searches the Microsoft repositories and outputs the information of all the apps that match the query.
    • winget install APP-NAME – Downloads and installs the specified application.
    • Example: winget install "Mozilla Firefox" – Install the Mozilla Firefox browser on your computer.
    • winget upgrade APP-NAME – Updates the installed app to the latest version.
    • Example: winget upgrade "Mozilla Firefox" – Updates the Mozilla Firefox browser.
    • winget uninstall APP-NAME – Removes the application from your computer.
    • Example: winget uninstall "Mozilla Firefox" – Uninstalls the Mozilla Firefox browser.

     

    winget search firefox

    (Image credit: Mauro Huculak)

    20. sudo (Superuser Do)

    The "sudo" (Superuser Do) command is a tool that allows you to run commands as an administrator from a Command Prompt window without elevation.

     

    If this tool sounds familiar, it is because it's similar to the Sudo command for Unix-based operating systems like Linux and macOS. However, the Sudo command on Windows 11 is not the same as the tool for Linux and macOS. Instead, the tool only includes limited functionalities to run elevated commands inline, with input disabled, or in a new window.

     

    Usage:

     

    • sudo COMMAND
    • Example: sudo del file.txt

     

    Command Prompt sudo command

    (Image credit: Mauro Huculak)

     

    This is a feature that comes disabled by default on Windows 11. If you want to enable it, you have to open Settings > System > For developers, turn on the "Enable sudo" toggle switch and choose the "Inline" option to run elevated commands within the same window as on Linux and macOS.

     

    Source


    Hope you enjoyed this news post.

    Thank you for appreciating my time and effort posting news every day for many years.

    News posts... 2023: 5,800+ | 2024: 5,700+

    RIP Matrix | Farewell my friend  :sadbye:


    User Feedback

    Recommended Comments

    Windows 11 essential commands??? There is only one...

     

     Format C: /P:1

     

    Edit for liability disclaimer...  if you don't know what this does, don't be daft enough to type it 🤔 🤣

    Edited by Mutton
    I'm sure we're all intelligent here, but...
    • Haha 2
    Link to comment
    Share on other sites




    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.
    Note: Your post will require moderator approval before it will be visible.

    Guest
    Add a comment...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...