How To Remove Write Protection on USB Flash Drive Using CMD

OverviewRead & write lock is a common issue with the USB flash drive/pen drive. In this article, you will see what are the reason behind disk protection and how can you remove write protection from the USB Flash drive.

USB Flash drives or Pendrives are the easiest way to carry and transfer any type of data like images, documents, music, movies, etc from one computer to another. The higher capacity of flash drives is also used for data storage. Flash drives are handy in  Windows Installation and specific troubleshooting.

However, sometimes you may get an error while transferring data from a computer to a USB flash drive “The disk is write protected, remove the write protection or use another disk”.

Why does Your Flash Drive Get Write Protect?

Some malware or software can affect the registry entries in Windows computers, or the system admin has put some restrictions on the ports, or your flash drive may be corrupt.

This error occurs when Write protection to your USB flash drive is enabled, and you cannot transfer any data to the flash drive and can’t delete data from the flash drive. However, you can copy data from the flash drive to your computer.

Write protection to flash drive is sometimes useful, say, you have some important data then enable write protection and prevent accidental deletion or format, also it is not easy to delete data for a non-tech person.

disk is write protected

So enabling and disabling write protection is a good idea to keep your data secure. Sometimes different types of malware can enable write protection to the USB drives.

Remove Write Protection From USB Flash Drive Using CMD

Usually, people take Write protection as a problem, since they cannot copy data to a flash drive so this is a big issue. Many people throw their flash drive assuming that it is useless now. So here are simple steps by which you can disable write protection from a USB drive using the command prompt.

1. Insert your flash drive into the PC.

2. Go to Start and search for cmd right-click on it and “run as administrator“. Or Windows 10 11, 8.1 user press the Start button + X and select Command Prompt (Admin).

search for cmd

3. Once the command prompt is open, type diskpart and hit Enter, it will give you access to manage the disk partition.

4. Type list disk and hit Enter. It will show you all connected disks to your computer, like disk 0, disk 1 along with their storage capacity.

remove write protection

5. Find your flash drive by its storage capacity like mine is  16 GB ( As per the Manufacturer) which is showing here  14 GB (Actual Size) as Disk 1 or remove all other external drives except your Flash Drive. Then you will get as above, and Disk 1 is going to be your Flash drive.

6. Now type Select Disk #  (Select disk <disk no.>)

As in the above case, I need to type Select disk 1 and hit Enter. It will select disk 1, and any further command will apply on disk 1.

select disk flash drive

7.  Now you need to check if your flash drive is Write protected.

Just type attributes disk and hit enter; it will show you the current status of disk protection.

disk attributes
Currently, the disk is write protected

Check the “Read-only State”; if it is Yes, then the disk is write protected.

8. To disable write protection,  type attributes disk clear readonly and hit enter.

disable write protection cmd commands

The above command will clear the read-only mode from your flash drive, and it won’t be write-protected anymore. You can copy and delete data from your flash drive as usual.

Changing Registry Value to Disable Write Protection

You may be unaware that there are some corrupt registry entries in your Windows computer leading to the write-protected flash drive. Changing the registry value is a good idea if the cmd method doesn’t work.

Try to connect the USB drive to another PC and check whether it is working. If it is working on another computer then there is a problem with your first PC.

If not, your flash drive is write-protected, or it is corrupted. (Use the cmd method to fix it)

To fix the corrupt registry value, follow these steps-

 1. Press the Win + R keys together, and it will open the “Run” dialog box.

2. Type in “regedit” and hit OK. It will open the registry editor

Now navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies

3. Make sure to highlight StorageDevicePolicies to see the registry values.

4. On the right pane double, click on “WriteProtect

5. In the Value box, if it has a value “1”, change it to “0” and hit OK to save the changes.

The value 0 removes the write protection from the registry.

Now, reboot your computer and check if the flash drive is working or not.

What if there is no such registry key?

By any chance, if you don’t see StorageDevicePolicies in the control folder, then it is easy to create.

1. Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control inside the registry editor.

2. In the Control folder right click on the black space in the left pane. Select New -> Key and name this folder “StorageDevicePolicies”.

3. Now highlight the created folder, and you will be able to see the registry keys.

4. On the right pane, right-click on the blank space and select “New -> DWORD” name the new key as WriteProtect and change the value to “0“.

Reboot your computer to make changes effective. Now you would be able to copy data to the flash drive.

How to Format Write Protected USB Flash Drive Using CMD

This is something you wouldn’t want to do if your flash drive has important data in it, but if everything fails and you want to save the flash drive, then try to format it.

Just open My Computer or This PC, select the flash drive and right-click on it then click on Format. It may take some time to format the drive into NTFS (New file system).

If you can’t format the flash drive using Windows GUI, then use the cmd to format it.

1. Follow the steps given in the first method till Step 6 where you can select the flash drive inside diskpart.

2. After selecting the disk type in format fs=fat32 quick and hit Enter. Or you can format it as NTFS by typing format fs=ntfs quick

This will completely format the flash drive, you may recover the lost data using file recovery tools like Recuva or Undelete.

Enable Write Protection to Flash Drive

In any case, if you want to protect your data from deletion or formatting flash drives, then you can enable write protection which will help you to secure your data.

  1. Open cmd as admin.
  2. Type diskpart to enter into disk partition mode.
  3. Now type list disk and it will show you all the disks.
  4. Type select disk <disk_no> and hit enter to select the flash drive. (Find flash drive disk number by its storage capacity).
  5. Type attributes disk set readonly and hit enter.

enable write protection

This will set your flash drive in Read-Only mode, which is write-protected.

All the above steps to enable and disable write protection applies on USB flash drive, Micro SD Cards, Camera, and any other removable storage device.

In case you have a Camera Memory card, then first you need to check the lock button on the side of the memory card.

If it is write-protected then flip the lock switch on another side (Up-Down) it will disable write protection from the Camera Memory card or if you are using a memory card holder for SD Cards.

disable write protection

Also, you can follow the above steps if the lock button does not work or is broken.

If you want to buy a USB 3.0 Flash drive for faster read and write operation, then here is my recommendation for you; this flash drive and its performance are tested by me. Buy Faster USB 3.0 Flash Drive (Affiliate link), which has a transfer speed of up to 225 MB/s.

Also Read

Share this article

About The Author

Notify of
Oldest Most Voted
Inline Feedbacks
View all comments