The Windows Command Prompt and PowerShell have transformed how you manage files, programs, and system settings. No more clicking through menus—just type commands to automate tasks, repair issues, or install software quickly. If you’re familiar with Linux or macOS, you’ll recognize these tools as powerful alternatives. If you’re starting fresh, this guide gives you the essentials to start working immediately.

What You'll Need

  • Windows 10 (version 1903 or later for modern commands; older versions may require compatibility mode).
  • A PC with the latest Windows updates installed.
  • Basic familiarity with file locations (e.g., "C:\Users") or willingness to learn.
  • Optional: A text editor (like Notepad) to write and save scripts.

Step-by-Step

  1. Open the Command Prompt: Press Win + R, type cmd, and hit Enter. For PowerShell, repeat but type powershell. If it’s not found: Search for "Command Prompt" in the start menu or use the shortcut Win + S > "cmd" > Open.
  2. Switch to a different user account or profile: Type exec powershell Start-Process cmd -ArgumentList "/k whoami" to check your current user. If you need to switch, use: runas /user:YourUsername cmd (replace *YourUsername*). Note: Requires admin rights unless you have a dedicated account. If you get an error, run CMD as admin first.
  3. Verify your current directory: Type cd and press Enter. You’ll see the directory you’re in (e.g., C:\Users\YourName). To see the full path, type echo %cd% (older commands) or Get-Location (PowerShell).
  4. Navigate to a folder: Use cd "path\to\folder" (e.g., cd C:\Downloads). For PowerShell, use forward slashes: cd C:\Downloads. To go up one level, type cd ...
  5. List files and folders: Start with dir (for plain output) or dir /w (wide format) to see files in the current folder. Add /a (all files, including hidden/system) or /s (recursive listing). Example: dir /a will list all files, including .bat or .tmp files.
  6. Create a new folder: Use mkdir "NewFolderName" (note spaces in the name). For PowerShell, the command is the same. Warning: Avoid spaces in folder names if you later run scripts in CMD.
  7. Copy and move files: Copy: copy "source.txt" "destination" (overwrites if destination exists). To copy multiple files, use copy *.txt "folder". Move: move "file.txt" "C:\NewLocation". PowerShell uses Copy-Item and Move-Item instead. Warning: Use move /y to avoid prompt when overwriting.
  8. Delete files or folders: Delete a file: del "file.txt" (faster than "remove"). For multiple files, use del *.log. Delete a folder: rmdir "folder" (only if empty). Force delete with rmdir /s /q "folder" (PowerShell uses Remove-Item -Recurse -Force). Warning: Deleting folders recursively (/s) removes *everything* inside.
  9. Search for files: Use dir "C:\path\to\folder" /s filename (replace *filename*). For PowerShell, type: Get-ChildItem -Path "C:\path\to\folder" -Recurse -Filter "filename". Tip: Add /b to CMD to get plain text output (e.g., dir C:\ /s *.txt /b).
  10. Install a new program or update drivers: Install from a ZIP: Extract first, then: cd "extracted_folder" setup.exe /S (suppresses prompts; check the installer’s documentation). Update drivers: Use wmic to find outdated drivers: wmic /namespace:\\root\cimv2\class_ /query "SELECT * FROM Win32_PnPEntity WHERE DriverInstalled = 'False'" (list devices needing updates). For manual updates, use devmgmt.msc (Device Manager).

Common Mistakes

  • Forgetting to close CMD after scripting: Use exit or type null to force a clean exit. Scripts may hang if CMD is still open.
  • Running as admin for every command: Only use admin rights for installation or system changes. Most tasks can run as a standard user.
  • Typing incorrect paths: Always use double quotes for spaces in folder names (e.g., "Program Files"). For PowerShell, use the parenthesis style: C:\"Program Files".
  • Overwriting files without confirmation: Use move /y in CMD or -Force in PowerShell to skip prompts.
  • Confusing CMD and PowerShell: Use echo %PATH% in CMD to check system variables. In PowerShell, type $env:PATH.

Tips

  • Use shortcuts: Ctrl + V pastes text into CMD (not just code). Alt + Space opens the window menu in CMD.
  • Create a shortcut to CMD/PowerShell: Right-click the desktop > New > Shortcut. Enter cmd or powershell and add a shortcut name.
  • Customize the prompt: Edit PATH in the system environment variables (System Properties > Advanced > Environment Variables) to add your favorite folder to the PATH.
  • Teach yourself with online guides: Use man command_name in PowerShell (e.g., man dir) to see detailed help. For CMD, search the Microsoft documentation from CMD itself.
  • Script for automation: Save commands to a text file (e.g., backup.bat) and run it with batch backup.bat. For PowerShell, use powershell -File script.ps1.

Troubleshooting

  1. CMD/PowerShell opens blank or frozen:
    1. Restart your PC or try a different port (e.g., Win + R > type cmd /k).
    2. Update Windows (Settings > Update & Security > Windows Update).
    3. Check the Windows Update (WSUS) status: net stop wuauserv && net start wuauserv.
    4. If still stuck, use exit and restart CMD from the start menu.
  2. Commands don’t work in one terminal but not others:
    1. Switch to PowerShell or CMD and type where command_name (e.g., where dir) to confirm the command exists.
    2. If missing, update Windows or install the latest Windows updates.
    3. For PowerShell-specific commands, ensure you’re in the right profile (type Get-ChildItem $PROFILE).
  3. Permission denied errors:
    1. Run CMD/PowerShell as administrator (right-click > Run as admin). For standard users, check if the action is restricted.
    2. If installing software, use setup.exe /S (suppress prompts) or check the installer’s documentation.
    3. For folder permissions, use icacls "folder" (PowerShell) or open Properties > Security tab to adjust.
  4. Script runs but does nothing:
    1. Open a new CMD/PowerShell and type type script_name to verify the script exists and has content.
    2. Check for typos in commands or path names.
    3. Add pause to the end of the script to keep it open after execution.

Frequently Asked Questions

Why is CMD slower than Windows Explorer?

CMD processes commands in real-time, while Windows Explorer uses a file system browser with visual rendering. For large folders, CMD can be faster for searching or batch operations.

Can I use CMD/PowerShell on Windows 7?

Yes, but Windows 7’s CMD lacks many modern commands (e.g., Get-Location). Use compatibility mode or upgrade to Windows 10/11 for full functionality.

How do I adjust the CMD/PowerShell color scheme?

Use a third-party tool like Windows Terminal (Settings > Apps > Optional Features > Add a feature > Windows Terminal) for custom themes. For pure CMD/PowerShell, edit the theme via registry keys (advanced users only).

What if I get a "command not found" error?

Check if the command exists in your system PATH. Add it manually by editing the PATH variable (System Properties > Advanced > Environment Variables) or download the full Windows SDK for missing tools.

Can I use CMD commands in PowerShell?

Yes, but most commands work the same way. For example, dir in CMD is Get-ChildItem in PowerShell. Use cmd /k to run CMD commands from PowerShell.

How do I backup my CMD/PowerShell history?

Enable history in PowerShell: Set-ItemProperty -Path $PROFILE -Name HistoryWritePreference -Value "WriteToFile". In CMD, history is saved as cmdhist.txt in the current directory.