Open the Windows Registry editor with the shortcut Windows-r , enter regedit
Navigate to the following Registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies
Please note that you may need to create the key StorageDevicePolicies if it does not exist. Select the key afterwards and right-click into the right window. Select New > Dword (32-bit) Value from the context menu and name the entry WriteProtect.
Double-click the new entry afterwards and change the value from 0 to 1. A value of 1 disables writing to all connected USB devices. If you want to enable writing again you need to change the value of the key to 0.
OR…
Try this
Use two Registry files to enable or disable write protection. You can download a zip file that contains both files here: write protect
This way you can disable write protection with a click on a file, and enable it again when you have copied files to the USB device or format USB device.
Thx to. ghacks