Friday 2 October 2015

How to Unblock USB Ports-Through Regedit,Batch script & C

Sometime we want to copy data from our college’s computers…but when we plug in the USB drive, system didn’t show it off...actually at that time the USB ports are disabled by the college authority due to some reasons.Here Today I’m going explain you that how to disable/Enable USB ports.




 There are several methods to do it , so first we start from the Basic Method (i.e., Directly Edit the Registry) 

Regedit Method


          1. Open registry [Go to START MENU > RUN >Type regedit and hit Enter].

          2. Navigate to
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR
3. Now in right side pane Double click on REG_DWORD Start, A pop up window appears.
Change its value to 4 for Disable the USB
Change its value to 3 for Enable the USB

Through Batch Script

1. Open Notepad [Press Windows_Key+R combination then type notepad and hit Enter] 

2. Copy/paste the following code to notepad
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR /v Start /t REG_DWORD /d 4 /f
3. Now save it as BlockUSB.bat.
4. Again open notepad and copy/paste the following code
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR /v Start /t REG_DWORD /d 3 /f
save it as UnblockUSB.bat

How to Use these Files
1. Open BlockUSB.bat with Administrator permissions to disable the USB drive.

2. Open UnblockUSB.bat file with Administrator permissions to enable the USB drive.

Through C Programming

"First of all I want to clear you that here we didn’t use something new...We just transform the above Batch Script Code into C source Code"

1. Open your C-compiler and copy/paste the below given Source Code.
#include<stdio.h> void main() { system("reg add HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\USBSTOR \/v Start \/t REG_DWORD \/d 4 \/f"); }

   Compile it and Save it As BlockUSB.c.
 2. Again open your C compiler and Copy/paste below given Source code.
#include<stdio.h>void main(){system("reg add HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\USBSTOR \/v Start \/t REG_DWORD \/d 3 \/f");}
 Compile it and save it as UnblockUSB.c.
3. Now you can use/execute/run BlockUSB.c to blocking the USB ports and UnblockUSB.c to Unblock.

Thank You

Keep Visiting

No comments:

Post a Comment