How to Add or Remove Write Protection from USB Drive or SD Card using Command Prompt?

It sometimes happens that you give your SD card or USB drive to your friend, any person or unknowingly connect it with any infected computer and in return you get infected files (Virus, Spywares, worms, etc.) on your device which get a transfer from your friend’s or the person’s computer. Sometimes any person puts some kind of infected file in your device intentionally. But don’t worry, you can add write protection to your USB drive and avoid it.

There was a time when pen-drives used to come with a write protection mechanism which consists of a switch on a housing of the drive itself, but now very few such pen-drives are available with that feature. Now, we can easily Add or Remove Write Protection from USB drive or SD card using Command Prompt.

How to Add or Remove Write Protection from USB drive or SD card using Command Prompt?By definition, Write protection is the ability of a hardware device or software program to prevent new information from being written or old information being changed. Typically, this means you can read the data, but not write. Which simply means, a person can view and copy any file from your pen-drive\SD cards, but he (or anyone) can not make any change in the pen drive\SD card like Formatting, Deleting files or Copying any file (including infected files like Virus, Spyware, worms, etc.) to your pen-drive\SD card.

Also Read: TRP Guides: How to Password Protect Folders and Files in Windows?

Adding or Removing Write Protection From your USB drive\SD card

Follow the following steps to Add Write Protection:

Step 1.

Type cmd in the Run box to open Command Prompt.

Command Prompt Trick to Add or Remove Write Protection from USB drive or SD cardStep 2.

Now in Command Prompt window, Type “diskpart” without “” as given in the image below:

Command Prompt Tricks to Add or Remove Write Protection from USB drive or SD card

Step 3.

Now diskpart window will appear (New window will not appear and it will continue from the next line if you have Run the Command Prompt as an administrator) as given in the image below:

Command Prompt Tricks to Add or Remove Write Protection from USB drive or SD card

Step 4.

Now in the diskpart window, type “list disk” without ” ” and press Enter to check the list of drives connected to the computer as shown in the image below:

Command Prompt Tricks to Add or Remove Write Protection from USB drive or SD card

Step 5.

Check your USB drive\SD card from the list according to the Size and then type “select disk ###” without “” where ### is the disk number. Here in the image below I have typed “select disk 1” because my drive was ‘disk 1‘. Similarly, you can find yours by checking size.

Command Prompt Tricks to Add or Remove Write Protection from USB drive or SD card

Step 6.

Now type “attributes disk” without “” and press Enter button to see the permission of the drive.

Command Prompt Tricks to Add or Remove Write Protection from USB drive or SD card

Step 7.

After following step 6, you will observe that a list of state and permissions will appear. Here you can check that ‘Current Read-only State: No‘ which means there is no write protection added on the drive. As shown in the image below:

Command Prompt Tricks to Add or Remove Write Protection from USB drive or SD card

Step 8.

Now to Add Write Protection, type “attribute disk set readonly” without “”. As highlighted in the image below:

Command Prompt Tricks to Add or Remove Write Protection from USB drive or SD card

Now you have successfully added Write Protection to your USB Drives. Whoever tries to make any change in the pen-drive\SD card like Formatting, Deleting files or To copy any file to your pen-drive\SD card, these messages will pop up:

How to Add or Remove Write Protection from USB drive or SD card Using Command Prompt? How to Add or Remove Write Protection from USB drive or SD card Using Command Prompt?

Also Read: Top 10 Best Malware Removal Tools for Windows

To Remove Write Protection from USB or SD Card

Follow till ‘Step 6’.

Now,

Step 7.

You will now observe that a list of state and permissions will appear. Here you can check that ‘Current Read-only State: Yes‘ (highlighted in the image) which means there is Write Protection added on the drive. As shown in the picture below:

How to Add or Remove Write Protection from USB drive or SD card Using Command Prompt?

Step 8.

Now to Remove Write Protection, type “attributes disk clear readonly” without “”. As highlighted in the image below:

Command Prompt Tricks to Add or Remove Write Protection from USB drive or SD cardNow you have successfully Removed Write Protection from your USB Drives. Anyone can make any changes in the pen-drive\SD card like Formatting, Deleting files or Copying any file to your pen-drive\SD card.

That’s it! We have now seen how to Add or Remove Write Protection and its importance in saving the Data in the USB drive\SD Card from being deleted and also saving the device from the infected file by restricting any thing to get copied to the device.

Don’t Miss:

  1. How to Install Apps on the SD Card or Other Removable Storage in Windows 10?
  2. TRP Guides: How to Make Windows 10 Run Faster on PC?
  3. 17 Cool Computer Command Prompt Tricks and Hacks for Windows Users
  4. 13 Excellent Microsoft Edge Tips and Tricks for Windows 10 Absolute Beginners
  5. 11 Best Media Players for Windows – Paid + Free Windows Media Players

Meet Author

Abhishek Dubey

Abhishek Dubey, also popularly known as AbhiTechy, is a tech geek who fell in love with the technology world at the early age of 14 years. He is co-founder of TechReviewPro.com. He is a gadget freak and an Apple fanboy. Abhishek loves messing up with iOS tips-tricks, hacks, and guides. When he is not writing here, you'll find him making useful videos about the latest gadgets, apps, software and various important iPhone-iPad-Mac tips-tricks and tutorials to share with the people on the AbhiTechy YouTube channel.

Pin It on Pinterest

Share This