Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Turn off and enable USB function

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Turn off and enable USB function

First, turn on the USB function.

: USB-Enable@echo off:step1if exist C:\ Windows\ INF\ usbstor.inf (cls&goto: step2) else (cls&goto: step3): step2if exist C:\ Windows\ INF\ usbstor.inf.bak (cls&goto: exit) else (cls&goto: copy2): step3if exist C:\ Windows\ INF\ usbstor.inf.bak (cls&goto: copy1) else (cls&goto: exit) exit:copy1copy C:\ Windows\ INF\ usbstor.inf.bak C:\ Windows\ INF\ usbstor. Inf reg add "HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Services\ USBSTOR" / v Start / t reg_dword / d 3 / f:copy2copy C:\ Windows\ INF\ usbstor.inf C:\ Windows\ INF\ usbstor.inf.bak:exitexit

Second, turn off the USB function.

:: USB-Disable@echo off:step1if exist C:\ Windows\ INF\ usbstor.inf.bak (cls&goto: step2) else (cls&goto: step3): step2if exist C:\ Windows\ INF\ usbstor.inf (cls&goto: del) else (cls&goto: reg): step3if exist C:\ Windows\ INF\ usbstor.inf (cls&goto: copy) else (cls&goto: exit) exit: regreg add "HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Services\ USBSTOR" / v Start / t Reg_dword / d 4 / f:copycopy C:\ Windows\ INF\ usbstor.inf C:\ Windows\ INF\ usbstor.inf.bakdel / s C:\ Windows\ INF\ usbstor.infreg add "HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Services\ USBSTOR" / v Start / t reg_dword / d 4 / f:deldel / s C:\ Windows\ INF\ usbstor.infreg add "HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Services\ USBSTOR" / v Start / t reg_dword / d 4 / f:exitExit

Third, sum up.

1. The script has been tested successfully on both window xp 7 and win10. If you need readonly to change the registry value to 1, you can test it if you are interested.

2. The script can be executed successfully after the GPO is issued, but the network exception execution is not successful due to some problems.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report