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. Checked against Microsoft Learn on September 28, 2026.
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.

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.
- Select Start, type cmd, right-click Command Prompt, and select Run as administrator.
- Type
diskpartand press Enter. - Type
list diskand press Enter. Find your USB drive by its size. - Type
select disk 1, using your USB drive’s number, and press Enter. - Type
attributes disk clear readonlyand press Enter.

- Type
exitand press Enter, then unplug the drive and plug it back in.
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. See how to format a drive in Windows 10.
- 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.
Frequently asked questions
Why is only one file read-only?
That’s a setting on the file, not the drive. Right-click the file, select Properties, and clear Read-only.
How do I find my drive’s disk number another way?
Open Disk Management. See how to open Disk Management in Windows 10. To open Command Prompt, see how to open Command Prompt.
How do I unplug it safely afterward?
See how to safely eject a drive in Windows 10.
If the drive is an SD card, see how to open an SD card on Windows 10.
Microsoft’s reference is attributes disk. More help is on our Windows Help & Guides page.
Related: How to reset USB ports on Windows 11.

Matt Jacobs has been working as an IT consultant for small businesses since receiving his Master’s degree in 2003. While he still does some consulting work, his primary focus now is on creating technology support content for SupportYourTech.com.
His work can be found on many websites and focuses on topics such as Microsoft Office, Apple devices, Android devices, Photoshop, and more.