How to disable and enable USB port via command prompt? Or using a batch script or VBScript? The OS is Windows 7.
Download utility devcon from Microsoft.
Then, use it as follows:
List all known USB devices:
devcon find USB*
Disable USB device:
devcon disable "USB\VID_xxxx&PID_yyyy"
Enable USB device:
devcon enable "USB\VID_xxxx&PID_yyyy"
I want to ask how can we enable or disable usb ports on windows vista pc. Also i have 6 usb ports , 2 in front and 4 at the back, so it it possible to disable the front usb port and enable 4 ports at the back.
The only way to disable the ports in software is to disable the USB Root Hub device that the ports are connected to.
There's no way to determine in software which port connects with which hub. However, you can use the Windows Device Manager (set the view to Devices by Connection mode) to locate the USB Root Hub devices on your system. When you plug a USB device into a port, Device Manager will update the view to show which hub the device is connected to.
You can then disable that port by disabling the hub it's connected to. This will also disable all other ports connected to that hub. There is no way around this.
The DevCon command-line utility functions as an alternative to Device Manager (more about using DevCon). You can use this to enable/disable the hub devices from the commandline.
The two front ports probably have a cable running from the front of the pc to the motherboard, just unplug it. It usually runs to a block of pins about 2 pins by 5 I think.
Go to Start → Run, type regedit and hit Enter or click on the OK button.
Browse to: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\UsbStor. Notice the value Start, it should currently be set to 3.
Change the value to 4 to disable USB storage devices, and back to 3 to enable them.