Board logo

标题: [文件操作] 批处理怎样删除U盘病毒? [打印本页]

作者: fei009    时间: 2008-8-20 19:21     标题: 批处理怎样删除U盘病毒?

具体功能:

运行后直接删除U盘上的autorun.inf文件和名为Recycled文件夹。

请高手写代码实现。

先谢谢了!!
作者: pusofalse    时间: 2008-8-20 20:52

这问题不应发这里吧。。。
  1. for %%a in (a b 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 (
  2.       if exist %%a:\ (
  3.          fsutil fsinfo drivetype %%a:|findstr "可移动">nul&&(
  4.             attrib -h -s -r %%a:\autorun.inf 2>nul
  5.             del /s %%a:\autorun.inf 2>nul
  6.             md %%a:\autorun.inf&attrib +h +s +r +a %%a:\autorun.inf
  7.       )
  8.     )
  9. )
  10. echo  Completed...
  11. pause>nul
复制代码
以上,只是删除autorun.inf
如果还要删除recycled 只需在del/s %%a:\autorun.inf 2>nul的下一行加上这两句:
attrib -h -s -r %%a:\recycled 2>nul
rd /s /q %%a:\recycled 2>nul
作者: 基拉freedom    时间: 2008-8-20 20:52

  1. @echo off
  2. del /s /q x:\autorun.inf & rd /s /q x:\Recycled ||del /s /q x:\Recycled
  3. echo OK &pause
复制代码
x为盘 就这点要求吗??
作者: fei009    时间: 2008-8-21 09:09

pusofalse,你有QQ吗?你的代码我不是很懂,希望能详细请教一下。
作者: 基拉freedom    时间: 2008-8-21 15:32

fsutil fsinfo drivetype %%a:|findstr "可移动">nul&&(
判断盘符是否为移动盘符
  attrib -h -s -r %%a:\autorun.inf 2>nul
把autorun文件去掉隐藏 系统 只读属性 不提示错误
    del /s %%a:\autorun.inf 2>nul
删除该文件
md %%a:\autorun.inf&attrib +h +s +r +a %%a:\autorun.inf
建立免疫文件夹




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