Steps to Remove Read Only Attribute via Command Line in Windows

In this post, you can learn how to remove read only attribute via Command Line to make your disk writable again. Besides. another three methods are also shared to clear read only attribute.

Posted by @Emily July 24, 2024 Updated By @Emily May 12, 2023

How do I remove read only attribute?

“Hi, guys, my Seagate external hard drive is stuck in read only mode, I cannot make any changes to data stored in it, so I need to remove read-only attributes from this disk on Windows 7 using command line. Could you please provide an example on this?"

Steps to remove read only attribute via Command Line

When a hard drive is set in read only mode, you will only be able to read data saved in that drive, but cannot add new data and modify the current data. To some degree, this write protection attribute can protect your data from being changed by others. But what if you want to make some changes? Then it is necessary to clear the read only attributes from the target disk. To finish it via Command Line (Diskpart service), follow the below instruction.

1. Click “Start” button and type “cmd” in the “Search” box, press “Enter”. Right-click the Command Prompt icon and select “Run as administrator”. Then type “diskpart” in the pop-out window and press “Enter” to launch Diskpart.exe utility.

2. Type “list disk” and press “Enter”: to get detailed information about every disk on your Windows computer.

3. Type “select disk” and press “Enter”. Here we select disk 1.

4. Type “attributes disk clear readonly” and press “Enter”: to remove the write protection on the selected disk.

Other methods to clear read-only attribute in Windows 11/10/8/7

The above steps only work when your disk is set into read only with the command (attributes disk set readonly). If your disk is write-protected for other reasons like wrong registry key, corrupted file system, disk errors, you can try the following methods to remove write protection attribute from disks.

Method 1. Edit the registry key

1. Press “Win+R” button at the same time to open “Run” dialogue and type “regedit” and hit on “Enter”.

2. In the Registry Editor window, navigate to the following path:

Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies

3. Double click the “WriteProtect” or right click on it, select “Modify” and change the value from 1 to 0.

4. Close Regedit and restart your computer. Connect your hard drive again and the read only attribute has been removed already.

Pay attention to: If there is no “StorageDevicePolicies” under the "Control" folder, you can create a rule manually. 1. Right click “Control” folder and select “New” > “Key”. Name it with “StorageDevicePolices” without quotation marks. 2. Then right click on the white space at the right-hand pane and choose “New” ->“DWORD (32-bit) value”. Name it with “WriteProtect”without quotation marks and open it to set the Value data to 0.

Method 2. Remove read only attribute by reformatting

If your disk becomes read-only due to the corrupted file system, you can reformat the disk to make it writable again. But when you try to format it in Disk Management, you will find the Format option is grey out, in File Explorer, you will receive an error message saying The disk is write protected. Then you can use the free partition manager: AOMEI Partition Assistant Standard. This freeware allows you to format read-only disk with ease in Windows 11/10/8/7. Moreover, you can also use it to format RAW drive.

Download Freeware Win 11/10/8.1/8/7/XP
Secure Download

Warning: formatting will lead to data loss, so you can back up important data on the read-only hard drive in advance.

1. Install and launch AOMEI Partition Assistant Standard. Right-click the drive with read-only attribute and select “Format Partition”.  

2. Select a desirable file system from the given list, then click “OK” to continue.

3. In the main interface, click “Apply” and then “Proceed” to execute the formatting operation.

Method 3. Check disk error on the read-only disk

If it is the disk error (bad sector) that causes the read-only issue, you cannot remove read only attribute using Command Line. Instead, you can use AOMEI Partition Assistant Standard to check and fix possible errors on the hard drive.

1. Run AOMEI Partition Assistant Standard. Right-click the read-only drive and choose "Advanced" > "Check Partition". 

2. Choose the first method to check and fix found error and click "OK".

3. Then wait for the process to be completed.

Summary

After you remove read-only attribute via Command Line or other recommended methods above, you will be able to add/copy new data to it and delete or modify data on it. The AOMEI Partition Assistant Standard is a versatile partition freeware. Apart from the above functions, it is also able to clone hard drive, clone partition, convert data disk to MBR or GPT without deleting partitions.

 If you upgrade to Professional edition, you can enjoy more amazing functions such as migrating OS to SSD, converting disk to MBR or GPT without deleting partitions, splitting partition, allocating free space from one partition to another and recovering lost partitions.