Using Windows Registry Editor
At first, you have to open Windows Run and type the command regedit. This will open Windows Registry Editor. The command will only run if you are a computer administrator.
When Windows Registry Editor opens, navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies. Most of the time the key StorageDevicePolicies is available by default, but if it’s not there, you will have to make a new one. To make it, you need to right-click on Control folder in the sidebar and click on the option New -> Key.
Afterwards, open StorageDevicePolices and make a new DWord which can be found on the right-click context menu.
All done. You can now edit any file on any removable device inserted in to your USB drive. You can also use a tool USB Write Protect for this purpose.
Using USB Write Protect
USB Write Protect is an extremely useful tool that allows write protection on all USB disk drives and secure if from any kind of virus. It is a portable tool and you just need to run the program, and select the Enable button to enable the lock. The program also has some extraordinary features which protect the USB drives from auto-run attacks.