How to Remove Write Protection from a USB Drive in Windows 10

Last updated on November 9th, 2026 at 02:12 pm

To remove write protection from a USB drive in Windows 10, first check the drive for a small lock switch and slide it to unlocked. If there’s no switch, open Command Prompt as an administrator, run diskpart, select the USB disk, and run attributes disk clear readonly.

Applies to: Windows 10.

What the error looks like

When a drive is write-protected, you can open files on it but can’t save, copy, rename or delete anything.

Windows 10 message saying the disk is write-protected
Windows reports that the disk is write-protected (1).

Check the lock switch

Many SD cards, SD card adapters and some USB drives have a small switch on the side. Unplug the drive, slide the switch away from Lock, and plug it back in.

Clear the read-only setting with diskpart

Be careful: pick the right disk number. The steps below only change the read-only setting and don’t erase anything.

  1. Select Start, type cmd, right-click Command Prompt, and select Run as administrator.
  2. Type diskpart and press Enter.
  3. Type list disk and press Enter. Find your USB drive by its size.
  4. Type select disk 1, using your USB drive’s number, and press Enter.
  5. Type attributes disk clear readonly and press Enter.
Windows 10 diskpart selecting disk 1 and clearing the read-only attribute
Select the USB disk (1), then clear the read-only setting (2).
  1. Type exit and press Enter, then unplug the drive and plug it back in.

How do I find my drive’s disk number another way?

Use Disk Management in Windows 10. If you’re stuck on the first diskpart step, here’s how to open Command Prompt.

Check the registry setting

A registry setting can make every USB drive read-only on your PC. If all your USB drives show the error, check it:

  1. Press Windows key + R, type regedit and press Enter.
  2. Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies. If the StorageDevicePolicies key doesn’t exist, this isn’t the cause, so skip ahead.
  3. Double-click WriteProtect, set it to 0, and select OK.
  4. Unplug the drive, restart the PC, and plug it back in.

On a work or school PC, this may be set by your organization on purpose. Don’t change it without asking.

Check the drive for errors

File system errors can also make Windows treat a drive as read-only. Open Command Prompt as an administrator and run chkdsk E: /f, replacing E: with your USB drive’s letter. Let it finish, then try copying a file again. If chkdsk reports bad sectors, the drive is failing, so copy your files off it.

Check for a policy that blocks USB writing

On Windows 10 Pro, and on many work or school PCs, a policy can stop every USB drive from being written to. To check on a PC you manage:

  1. Press Windows + R, type gpedit.msc, and press Enter.
  2. Go to Computer Configuration > Administrative Templates > System > Removable Storage Access.
  3. Look for Removable Disks: Deny write access or All Removable Storage classes: Deny all access. If either is Enabled, set it to Not Configured, then restart.

Check the same path under User Configuration too. On a work or school PC, these settings usually come from IT, so ask them rather than changing them. A quick test: if every USB drive is read-only on this PC but works on another, a policy is the likely cause.

If it’s still write-protected

  • Try another USB port or PC. If it’s locked on every PC, the problem is the drive.
  • Back up and format it. Copy the files you need to your PC, then format the drive. Formatting erases everything on it, so only format the drive in Windows 10 once your files are safe.
  • Replace it. Many flash drives lock themselves as read-only when they’re wearing out, to protect your files. Copy your files off and use a new drive.
  • Work or school PCs can block writing to USB drives on purpose. Ask the person who manages the PC.

Can a virus make a USB drive write-protected?

Rarely. Some malware changes the registry setting above. Run a full scan in Windows Security if the problem started suddenly on every drive.

Write protection that won’t clear or comes back

  • diskpart shows “The media is write protected” when you clear it. The drive itself has locked into read-only mode. This usually means the flash memory is worn out, and software can’t undo it.
  • The setting clears but comes back after you replug the drive. Same cause: the drive’s controller is protecting what’s left. Copy your files and replace it.
  • Only an SD card is affected. Check the lock switch on the card and on any adapter. Some adapters have loose switches that slide back to Lock as you insert them. Once the card accepts changes again, on a Windows 11 PC you can reformat the SD card as FAT32 if your camera or other device needs it.
  • Formatting fails with a write-protection error. Try the drive maker’s own format or repair tool from their support site. If that fails too, the drive can’t be fixed.

Will removing write protection delete my files?

No. Flipping the switch, clearing the diskpart attribute and changing the registry don’t touch your files. Only formatting erases them.

Working with an SD card? Here’s how to open an SD card on Windows 10.

The command is documented on Microsoft’s attributes disk page.

Related: How to reset USB ports on Windows 11.