Forum Discussion
Ottiaia
Aug 13, 2025Iron Contributor
Batch file needed for USB write and read only
I have a requirement for a office purpose. I want to give a usb pendrive write protected and read only permission, for any system I connect, the data shoudnt get deleted anytime in the pendrive. So I...
Physicatitude
Aug 13, 2025Copper Contributor
Run as administrator:
Echo off
reg add HKLM\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies /v WriteProtect /t REG_DWORD /d 1 /f # Read-only
reg add HKLM\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies/v WriteProtect /t REG_DWORD /d 0 /f # WritableThe above code can be used to create a batch file to toggle USB write protection.