The Windows Command Line (CMD) lets you check disk space instantly with simple commands, whether you’re troubleshooting storage issues or preparing for updates. Open CMD and run just one command to see free space on all drives; add more flags for detailed breakdowns, like partition usage or file types. No extra tools needed—just start with `wmic logicaldisk` or `df` (if available) for fast results.

What You'll Need

  • The Windows Command Prompt (CMD), available by default on Windows 10/11
  • Administrative or admin-rights access if checking system partitions (e.g., C:) or network drives
  • A text editor (optional) to review full details in a file (e.g., `notepad %temp%\diskreport.txt`)

Step-by-Step

  1. Open Command Prompt
    • Press Win + R, type `cmd`, and hit Enter (standard CMD).
    • For PowerShell as an alternative, use the command but note it won’t show partition details the same way:
    • Run Get-PSDrive | Select-Object Name, UsedBytes, FreeBytes (but this lists only "virtual" drives like the recycle bin).
  2. Check Free Space on All Drives Run this once to see all drives and their free space: wmic logicaldisk get deviceid,caption,freespace,size

    Example output: DeviceID Caption Freespace Size --------- ---------- --------------- ---- C: C: 123456789 524288000 D: D: 187654321 1024000000

    How it works: The caption shows the drive letter (e.g., C:), freespace is in bytes, and size is total capacity. Sort by size to see where space is tightest.

  3. Get Detailed Disk Usage by Type For a breakdown of files/folders consuming space (requires admin): wmic logicaldisk where "driveservertype=3" get caption,freespace,size,volumemodel

    Why admin? Some partitions (like system/reserved) are read-only unless you run CMD as administrator.

    For a more technical breakdown (Windows 10/11 only), use: dfs /s This shows files/folders by size on your current drive (C: by default).

  4. Check Specific Drive’s Free Space Example: Find free space on drive E: df -h /d E: /q

    Note: This command is available on Windows Server and some Windows 10/11 builds via the df tool. If it fails, use the `wmic` method from Step 2 with the drive letter.

  5. Save Results to a File Redirect output to a text file for reference: wmic logicaldisk get caption,freespace,size > diskreport.txt Open the file with Notepad to review.

Common Mistakes

  • Running CMD without admin rights System partitions (e.g., `C:`) may show "Access Denied" errors. Fix: Right-click CMD > Run as administrator.
  • Using `df` on non-server builds The `df` command may not exist. Use `wmic` instead, which works everywhere. Some Windows 11 users report it requires enabling the "Command Processor" service.
  • Ignoring network drives Network drives (e.g., mapped shares) can show low space but may not be logged in by default. Check them after adding the drive path to `net use`.
  • Overlooking the "Reserved Space" Windows reserves space for future updates (e.g., 3% of C:). Run `wmic logicaldisk where "driveservertype=3" get caption,freespace,size,volumemodel` to see this in raw bytes.

Tips

  • Shortcut for quick checks Append `/q` to `wmic` commands to quiet output (e.g., `wmic logicaldisk get caption,freespace /q`).
  • Compare drives visually Use `wmic`’s output to sort drives by size/freespace, then check the "Caption" column for drive letters.
  • Schedule reports Add the `> diskreport.txt` command to a task scheduler task to create daily storage snapshots (run as admin).
  • Avoid `dir` for disk space `dir /s` lists files but doesn’t show total space efficiently. Use `dfs` or `wmic` instead.
  • Check for hidden junk If space is low, search for large files with: dir /s /a-ad /b /o-s mydocuments\*.* > largelist.txt (This lists files by size in text format.)

Troubleshooting

  1. CMD won’t run admin commands

    Ensure admin rights: Right-click CMD > Run as administrator. If you’re still locked out, check if the "Command Processor" service is running: sc query winrm Restart it with `sc stop winrm /y` then `sc start winrm`.

  2. Output shows "Access Denied" for C:\

    Try running CMD in an elevated prompt or enable "Compatibility" mode for CMD (right-click CMD > Properties > Compatibility > Check "Run this program as administrator").

  3. `df` command is missing

    Windows does not include `df` by default. Use `wmic` instead. To enable `df` on Windows 11, add it to `PATH`: setx PATH "%PATH%;C:\Program Files\Git\bin" (Requires Git installed. Then run `df -h /d C: /q`).

  4. Drive appears empty when it’s full

    Common causes:

    • Files are locked by another process (e.g., antivirus). Close all programs, then check again.
    • You’re looking at the wrong drive. Use `wmic logicaldisk get caption,freespace,size` to confirm.
    • Network drives may sync in delays. Wait 10+ minutes or check manually on the server.

Frequently Asked Questions

How do I check disk space on a specific folder?

Use `dfs` for the current drive: dfs /s "C:\YourFolder" For a quick byte count: dir /s "C:\YourFolder" /b | sort /r /n | head -5 (highlights the largest 5 files in a folder).

Why does `wmic logicaldisk` show 0 bytes free?

This usually means: 1. The drive is full. 2. Files are locked by another program (e.g., antivirus). 3. You’re viewing a network drive with pending syncs. Wait 10+ minutes or check manually.

How can I clear disk space in CMD?

Use these steps: 1. Run `net use * /delete` to remove mapped network drives. 2. Delete large files manually: del /s /q "C:\OldFiles\largefile.exe" 3. Reclaim space from the Recycle Bin (right-click Recycle Bin > Properties > "Empty Recycle Bin").

Does CMD check external drives?

Yes, but only if they’re mounted and accessible. To check: wmic logicaldisk where "drivertype=2" get caption,freespace,size (Driver type 2 = removable drives like USB).

How do I check disk space in Windows 7?

Use `wmic` only: wmic logicaldisk get deviceid,caption,freespace,size No `dfs` or `df` commands exist in Win7.

What if my disk space is critical and CMD doesn’t help?

If CMD shows a drive at 90%+ usage, manually check: - Temp files: del /q /s %temp% - Downloads: Move to external drive or folder. - Thumbnails: Disable in Windows Features (Control Panel > Programs > Turn Windows features on/off > Check "Windows Image Access").