How can write protection be activated or deactivated on a data medium?

Today we would like to show you how you can activate or deactivate write protection for any data medium . This can make sense to prevent the files on the data carrier from being deleted or the entire data carrier from being reformatted. Incidentally, this works with internal and external data carriers connected via USB.

Of course, you can usually activate manual write protection for USB sticks. However, we would like to demonstrate below how you can activate the write protection with a command on a connected USB stick .

First of all an MS-DOS prompt with administrative rights has to be called up. You must then issue the following commands one after the other.

  • diskpart
  • list disk
  • select disk ??
  • attributes disk set readonly

This looks like this in the original.

diskpart disk read-only

It is important that you use the “ select disk ?? “Entered the correct number, which also denotes the correct data carrier. In our case it is number 2 for the USB stick with a capacity of 8 GB. After you have issued the 4 commands, the activated write protection is acknowledged with the following feedback.

The disk attributes have been successfully set.

If you now try to write or copy a file to the data medium, Windows Explorer brings the following message.

The disk is read-only

The message that Windows Explorer then issues is:

The disk is read-only.
Unprotect or use a different disk.

By the way , if you want to deactivate the write protection, then the following command is necessary:

  • attributes disk clear readonly

This then looks like this in the command prompt:

attributes disk clear readonly

Finally, we present you further articles dealing with other useful Windows commands.

– Convert FAT32 data carrier to NTFS format without data loss – Reset
the local GPOs completely
using a command – ISOBURN – Windows ISO burning program as command line command – Generate
large dummy files quickly and manually using a command using FSUTIL
– Call up system administration tools in Windows 10

Show or delete available WLAN connections with a command – RAM diagnosis with MDSCHED (Windows command)
– Control shortcuts for important Windows setting options
– PowerShell command to deactivate the firewall
– Shut down Windows and restart with PowerShell commands

administrator