Saturday, 15 March 2014

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

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.

 Please leave your Valuable Comments :)


  1. Amazing blog and very interesting stuff you got here! I definitely learned a lot from reading through some of your earlier posts as well and decided to drop a comment on this one!

    1. it's our pleasure that you like our articles,i just want to say that we need your support so keep supporting us .
      Have a Good Day..!

  2. It ask for administrator there another way to bypass it??

    1. OK.. i'll try to provide you the alternate solution to Unblock USB ports very soon..

      --Keep Visiting--

  3. can we block only one port not all ports ?

    1. For blocking any other or all ports follow these steps:-

      1.Press Windows+R (or go to start menu then open Run),Type devmgmt.msc & hit enter. it will Open Device Manager.

      2.Now find & Expand "Universal Serial Bus Controllers"
      3.Right Click the USB port name to Disable or enable it.

  4. Your all tricks are helpful to me thanks bro

    1. thanks for appreciating our work :)..

      keep visiting

  5. thanks very useful

  6. That is an extremely smartly written article. I will be sure to bookmark it and return to learn extra of your useful information. Thank you for the post. I will certainly return.

  7. Hi, Really great effort. Everyone must read this article. Thanks for sharing.

  8. Thanks for sharing information.
    recharge offers
    videocontelecom offers new Customers the proposition will be available on Plan voucher (PV) priced at Rs 76, offering All Local Calls at 25P/min only for 6 months including Rs 63 Talk time; 1050 MB data for 3 month and 100 SMS free/day, with first 2 SMS of the day chargeable at rack rate only in Haryana.