Easy way to Write Protect a USB Drive

by Friday, February 10, 2012 0 comments

This is possible with the given Batch Script Code -

:main
@echo off
cls
echo. & echo. & echo.
echo USB Write Protect program
echo ________________________________
echo. & echo.
echo 1. Lock the USB Drive
echo 2. UnLock the USB Drive
echo 3. Exit
echo.
set/p “ch= [>] Enter: “
if %ch%==1 goto lock
if %ch%==2 goto unlock
if %ch%==3 goto exit
goto main
:lock
cls
echo. & echo. & echo.
echo [+] Attention:
echo.
echo Make sure that there is no USB Drives inserted.
echo.
echo ————————————————
pause
reg add HKLMsystemcurrentcontrolsetcontrolStorageDevicePolicies /t reg_dword /v writeprotect /d 1 /f
pause > nul
goto main
:unlock
cls
echo. & echo. & echo.
echo. & echo. & echo.
echo [+] Attention:
echo.
echo This operation doesn’t require to Unplug the USB flash Frive
echo so Continue without FEAR.
echo.
echo —————————————————
pause
reg add HKLMsystemcurrentcontrolsetcontrolStorageDevicePolicies /t reg_dword /v writeprotect /d 0 /f
pause > nul
goto main


You just copy above code into a Notepad file and save that file with .bat extension mean if you are creating a file with the name USB-PROTECT then put the USB-ROTECT.bat as a file name while saving it..


If you are not able to protect your USB Drive with the help of script file then just try it by following few simple steps because Protecting an USB drive depends on Registry and you can do it manually.

Simple Steps that you have to follow :- 
1- Start > Run > type "regedit" to open regisry editor
2- Navigate to this: HKey_LOCAL_MACHINESystemCurrentControlSetControl
3- Create a new key with the name "StorageDevicePolicies"
4- On the right side, Create a new "DWORD Value" with the name "WriteProtect" and give it "1" as Data
5- Then put the USB Flash Drive.
6- Try to Delete a file OR Copy something to it, You will not be able to do that in your system.
7- To disable this feature, just change the value  from 1 To 0

enjoy.

Unknown

Network Engg

i am Network Engg in WIPRO