Yes, you can instantly **list files, check disk space, or run system utilities** just by typing in the Command Prompt—not another GUI tool. This guide covers the most powerful, practical commands for Windows, from absolute beginners to power users.

What You'll Need

  • Windows 10 or 11 (older versions have slightly different syntax).
  • A PC with internet access for downloading tools like WinMerge or Sysinternals (if needed).
  • Open Command Prompt (search for "cmd" in the Start menu).

Step-by-Step

  1. Open Command Prompt
    1. Press Win + R, type cmd, and hit Enter.
    2. On Windows 11, you can also right-click the taskbar and select New window under Command Prompt.
    Tip: Use Alt+Tab to switch between Command Prompt and other apps. Close it with Ctrl+Shift+Esc + F1 to open Task Manager and end the process.
  2. Basic File Navigation
    1. Move to a folder: Use cd (change directory). For example, cd Documents.

      Shortcut: cd ~ goes to your home directory.

    2. List files in the current folder: dir.

      The output includes file names, sizes, and modification dates.

    3. List all files, including hidden ones: dir /a.

      Use dir /s to see files recursively (including subfolders).

  3. File Operations
    1. Copy files: copy sourcefile destination. Example: copy C:\Temp\file.txt D:\Backup\.

      Warning: If the destination folder doesn't exist, Command Prompt will prompt you again.

    2. Move files: move sourcefile destination. Example: move C:\Projects\oldfile.txt C:\Projects\newfolder\.

    3. Delete files: del filename. Use del /q filename to delete silently.

      Warning: Deleted files are gone permanently unless you have backups.

    4. Rename files: ren oldname newname. Example: ren C:\Temp\oldfile.txt updatedfile.txt.

  4. System and Disk Utilities
    1. Check disk space: wmic os get freeDiskSpace or wmic logicaldisk get size,freespace.

    2. Scan for viruses: Use chkdsk /f C: (replace C: with your drive letter). This fixes errors but may require rebooting.

    3. Restart your PC: shutdown /r /t 0. This immediately restarts your computer.

    4. Shut down: shutdown /s /t 0

  5. Networking Commands
    1. Check connected network devices: ipconfig /all.

      Look for IPv4 Address and Default Gateway to verify your network settings.

    2. Ping a website: ping google.com.

      Ping tests connectivity to the specified domain.

    3. View open ports: Use netstat -ano. Look for State showing ESTABLISHED.

  6. Advanced Commands
    1. Search files with where: Example: where notepad.exe.

    2. Redirect output: dir > output.txt saves the dir output to a file.

    3. Use for loops: Example to list all .txt files in a folder: for %f in (*.txt) do echo %f.

Common Mistakes

  • Typo Errors

    Spelling mistakes like dirs instead of dir will return an error. Always double-check commands.

  • Incorrect Paths

    If you enter a non-existent folder like cd Documents\, Command Prompt won’t move. Use cd alone to stay in the current folder.

  • Permissions Issues

    Commands like del or move may fail if you lack write permissions. Run Command Prompt as Administrator.

Tips

  1. Use Tab to autocomplete commands and paths. For example, cd C:\W + Tab fills in Windows.

  2. Press Ctrl+Shift+Enter to open a new Command Prompt window from the current one. This is useful for parallel operations.

  3. For large files, use xcopy instead of copy. Example: xcopy C:\Temp\folder D:\Backup\ /E /H copies all subfolders, hidden files, and preserves attributes.

  4. Backup frequently: Use copy or robocopy to create copies of critical files.

Troubleshooting

  1. Command Not Recognized

    You may need to enable Command Prompt for your user. Go to Settings > Control Panel > Advanced System Settings > Advanced > Environment Variables and ensure Command Prompt is listed in the Path variable.

  2. No Network Access

    Check your network settings with ipconfig /all. If you’re on Wi-Fi, verify the router IP address (usually 192.168.1.1 or 192.168.0.1).

  3. Slow Performance

    Run tasklist to check for resource-heavy processes. Close unnecessary apps and restart Command Prompt.

  4. File Deletion Errors

    If del fails, use attrib -r -h filename to remove read-only/hidden flags before deletion.

Frequently Asked Questions

Can I use Command Prompt for Python scripting?

Yes! Open a new Command Prompt window and type python script.py to run Python scripts directly. Ensure Python is added to your system PATH.

How do I find the installed programs via Command Prompt?

Use wmic product get name, version to list installed software and their versions.

What if Command Prompt won’t open?

Restart your PC or use the Task Manager (Ctrl+Shift+Esc) to force-close Command Prompt. If it still won’t open, check for system updates via wmic qfe list.

Can I use Command Prompt to edit files as text?

No. For text editing, use built-in editors like Notepad++ or Windows Notepad (with rich text). Command Prompt is for commands only.

What’s the difference between copy and xcopy?

copy only copies files; xcopy copies files and subfolders and includes options like /E (copy empty subfolders) and /H (copy hidden files).

How do I clear Command Prompt history?

Open the Command Prompt settings by typing cmd /k "setx /m path "%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Command Prompt\cmd.exe" -- /a cmd.exe /k set history=0" in another window. Then restart Command Prompt.