Ba generates VBS code to disable or enable USB ports through the registry


Of course, you can also use BAT operation registry to complete the purpose of modifying the key values of the registry, the specific way to stay perfect later, if you have good ideas, remember to tell me!

USB_Disable.bat file code:

Copy codeThe code is as follows:
@echo off
echo On Error Resume next>USB_Disable.vbs
echo Dim WshShell>>USB_Disable.vbs
echo Set WshShell = WScript.CreateObject(“WScript.Shell”)>>USB_Disable.vbs
echo wshShell.RegWrite “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR\start”, 4, “REG_DWORD”>>USB_Disable.vbs

cSCript USB_Disable.vbs
del USB_Disable.vbs

USB_Enable.bat file code:

Copy codeThe code is as follows:
@echo off
echo On Error Resume next>USB_Enable.vbs
echo Dim WshShell>>USB_Enable.vbs
echo Set WshShell = WScript.CreateObject(“WScript.Shell”)>>USB_Enable.vbs
echo wshShell.RegWrite “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR\start”, 3, “REG_DWORD”>>USB_Enable.vbs

cSCript USB_Enable.vbs
del USB_Enable.vbs

Save the above two pieces of code as bat files, you can double-click to run.

Recommended Today

Implementation of PHP Facades

Example <?php class RealRoute{ public function get(){ Echo’Get me’; } } class Facade{ public static $resolvedInstance; public static $app; public static function __callStatic($method,$args){ $instance = static::getFacadeRoot(); if(!$instance){ throw new RuntimeException(‘A facade root has not been set.’); } return $instance->$method(…$args); } // Get the Facade root object public static function getFacadeRoot() { return static::resolveFacadeInstance(static::getFacadeAccessor()); } protected […]