USB flash drives, memory cards, external hard drives, and other removable storage devices occasionally become write-protected in Windows 10. When this happens, users cannot copy files to the device, delete existing data, format the drive, or modify its contents. Windows typically displays error messages such as “The Disk Is Write Protected”, “Remove The Write Protection Or Use Another Disk”, or “The Media Is Write Protected.”
Write protection can occur for several reasons, including accidental disk attribute changes, registry settings, Group Policy restrictions, file system corruption, malware infections, manufacturer security features, or physical write-protection switches on storage devices. Fortunately, Windows includes built-in command-line tools that can often remove write protection without requiring third-party software.
This guide explains how to disable or remove USB write protection using Command Prompt (CMD) in Windows 10 and provides additional solutions if the DiskPart method does not resolve the issue.
Method 1: Remove USB Write Protection Using DiskPart Command
DiskPart is the most effective built-in tool for clearing write-protection attributes from USB drives.
Before proceeding:
- Connect the USB drive to the computer.
- Close File Explorer windows that may be accessing the device.
To remove write protection:
- Search for Command Prompt.
- Right-click it.
- Select Run As Administrator.
Type the following commands one at a time and press Enter after each command:
diskpart
Display connected drives:
list disk
Identify the USB drive by its size.
Select the USB drive:
select disk X
Replace X with the correct disk number.
Display current attributes:
attributes disk
Remove write protection:
attributes disk clear readonly
After receiving the success message, type:
exit
Disconnect and reconnect the USB drive.
Test whether files can now be copied or deleted.
This method resolves most software-based write-protection issues.
Method 2: Verify the Drive Is No Longer Read-Only
After clearing the disk attribute, confirm that the write-protection setting was removed successfully.
Open Command Prompt as Administrator again and run:
diskpart
Then:
list disk
Select the USB drive:
select disk X
Check attributes:
attributes disk
Review the output.
If Current Read-Only State and Read-Only both display No, the attribute has been removed successfully.
If read-only protection remains enabled, continue with the following methods.
Method 3: Use DiskPart to Clean the USB Drive
If write protection prevents normal formatting, cleaning the disk may resolve the issue.
Warning: This process removes all partitions and data from the drive.
Open Command Prompt as Administrator and run:
diskpart
List disks:
list disk
Select the USB drive:
select disk X
Clean the disk:
clean
Create a new partition:
create partition primary
Format the drive:
format fs=ntfs quick
Assign a drive letter:
assign
Exit DiskPart:
exit
The USB drive should now function normally if software corruption caused the issue.
Method 4: Check for a Physical Write Protection Switch
Some USB drives, SD cards, and memory cards include a physical lock switch.
Inspect the device carefully.
Look for:
- Lock
- Unlock
- Write Protect
- Read Only
If a switch exists:
- Move it to the unlocked position.
- Reconnect the device.
- Test file copying again.
No software solution can override a physical hardware lock.
This is particularly common on SD cards and certain flash drives.
Method 5: Remove Write Protection Through Registry Editor
Windows Registry settings can force removable drives into read-only mode.
To check:
- Press Windows + R.
- Type:
regedit
- Press Enter.
Navigate to:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies
Locate:
WriteProtect
Double-click it.
Set the value to:
0
Click OK.
Restart the computer.
Reconnect the USB drive and test again.
If the key does not exist, Windows is not enforcing write protection through this registry setting.
Method 6: Run CHKDSK to Repair File System Errors
File system corruption may cause Windows to treat storage devices as read-only.
To scan the drive:
- Open Command Prompt as Administrator.
Run:
chkdsk X: /f /r
Replace X with the USB drive letter.
Press Enter.
Allow the scan to complete.
Afterward:
- Remove and reconnect the USB drive.
- Test writing files.
This method repairs many logical disk errors.
Method 7: Scan the USB Drive for Malware
Certain malware infections modify storage device permissions and attributes.
To scan:
- Open Windows Security.
- Select Virus & Threat Protection.
- Click Scan Options.
- Choose Full Scan.
- Start the scan.
Additionally:
- Scan the USB drive directly.
- Remove detected threats.
- Restart the computer.
After cleaning malware:
- Test the drive again.
Security threats occasionally trigger write-protection symptoms.
Method 8: Update USB Storage Drivers
Corrupted storage drivers can cause removable drives to malfunction.
To update drivers:
- Right-click the Start button.
- Select Device Manager.
- Expand:
- Disk Drives
- Universal Serial Bus Controllers
Right-click the USB device.
Select:
- Update Driver
- Search Automatically For Drivers
Install available updates.
Restart Windows afterward.
Driver issues are less common but can contribute to storage problems.
Method 9: Reinstall the USB Device Driver
If updating does not help:
- Open Device Manager.
- Locate the USB drive.
- Right-click the device.
- Select Uninstall Device.
- Confirm removal.
- Disconnect the USB drive.
- Restart the computer.
- Reconnect the drive.
Windows automatically reinstalls the required driver.
After reinstallation:
- Test write access again.
This can resolve driver corruption issues.
Method 10: Test the USB Drive on Another Computer
Some storage devices develop hardware failures that permanently lock the drive in read-only mode.
To verify:
- Connect the USB drive to another computer.
- Attempt to:
- Copy files
- Delete files
- Format the drive
If write protection appears on multiple systems:
- The drive may be failing.
- Internal memory protection may have activated.
- Replacement may be necessary.
Unfortunately, hardware-based write protection usually cannot be removed through software.
Frequently Asked Questions
What causes a USB drive to become write protected?
Common causes include read-only disk attributes, registry settings, Group Policy restrictions, file system corruption, malware infections, physical lock switches, and hardware failures.
Which CMD command removes write protection?
The most commonly used DiskPart command is:
attributes disk clear readonly
This removes the read-only attribute from the selected disk.
Will DiskPart erase my files?
No. The command:
attributes disk clear readonly
only removes the read-only attribute. However, commands such as clean will erase all data.
Why does write protection return after removing it?
Recurring write protection often indicates file system corruption, malware, registry restrictions, or failing storage hardware.
Can a physically locked USB drive be unlocked using CMD?
No. A hardware write-protection switch must be moved to the unlocked position manually.
Final Thoughts
Write-protection errors can prevent you from copying, deleting, editing, or formatting files on a USB flash drive, memory card, or external storage device. Fortunately, Windows 10 includes the DiskPart utility, which can remove software-based write protection quickly through the attributes disk clear readonly command. In many cases, this single command restores full access to the drive.
If the issue persists, additional troubleshooting methods such as cleaning the drive, checking for physical lock switches, repairing file system errors with CHKDSK, modifying registry settings, updating drivers, and scanning for malware can help identify and resolve the underlying cause. By following the methods outlined in this guide, most users can successfully disable or remove USB write protection and regain normal access to their removable storage devices in Windows 10.


