中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --
联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
游客 | 登录 | 注册 | 会员 | 搜索 | 中国DOS联盟
中国DOS联盟论坛
现在时间是 2026-08-03 02:14
48,038 主题排行 / 350,123 发帖 / 今日 1 篇 / 48,251 会员排行
DOS批处理 & 脚本技术(批处理室) » 第一个批处理```请你们检查..
可打印版本  971 / 7
第1楼 Eblis 发表于 2007-01-13 22:17
中级用户 发帖 108 积分 251 来自 湖南==>广州
第一个批处理```请你们检查..
应朋友的要求帮忙写一个删除host自动播放病毒的批处理..沉默一晚..把论坛翻了一遍..写完了..总觉得有些杂..很多地方应该可以减少的...请各位帮忙检查一下..





@echo off
echo 此程序用于删除右键自动播放的svchost.exe病毒
echo 请稍等.....正在删除病毒文件


::首先结束病毒进程
:taskkill
tasklist >tasklist.txt
findstr /i "temp1.exe temp2.exe" tasklist.txt &&taskkill /f /im temp1.exe /im temp2.exe >nul 2>nul
del tasklist.txt

::删除病毒启动注册表和盘符自动播放
:delreg
reg delete "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows" /v "load" /f >nul 2>nul
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows" /v "load" /t REG_SZ /d "" /f >nul 2>nul
reg export "hkcu\software\microsoft\windows\currentversion\explorer\mountpoints2" delreg.reg >nul 2>nul
find /i "autorun" delreg.reg >temp.txt
for /f "skip=2 tokens=8 delims=\" %%a in (temp.txt) do reg delete HKCU\software\microsoft\windows\currentversion\explorer\mountpoints2\%%a\AUTORUN /f
del delreg.reg
del temp.txt


::删除病毒文件
:del
for %%l in (%systemroot% %systemroot%\system32) do (
for %%m in (autorun.inf host.exe copy.exe temp1.exe temp2.exe) do (
attrib %%l\%%m -r -s >nul 2>nul
del %%l\%%m /f /s /a :h >nul 2>nul
)
)
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 (
%%i: >nul 2>nul||if errorlevel=1 goto ok
for %%j in (autorun.inf host.exe copy.exe folder.exe) do (
attrib %%i:\%%j -r -s >nul 2>nul
del %%i:\%%j /f /s /a :h >nul 2>nul
)
)



:ok
@echo 删除完成...按任意键退出
pause >nul
goto :eof



──────────────── 版务记录 ────────────────
执行:namejm
原标题:第一个批处理```请你们检查..
说明:因标题过于模糊,不便于论坛的搜索和管理,请在三日内修改标题。
提示:修改标题请在当前帖的右下脚点
编辑修改完毕之后按 编辑帖子 即可。
处罚:因刚脱离论坛新人阶段不久,暂时不予处罚;若三日之后尚未修改标题,将扣除
  2点积分,以示惩罚,并由版主强制修改标题。请点击
这里阅读论坛发帖规定,
  以避免在今后的讨论中违规发帖。
──────────────── 版务记录 ────────────────


[ Last edited by namejm on 2007-1-14 at 09:38 PM ]
第2楼 boluor 发表于 2007-01-13 22:50
初级用户 发帖 54 积分 129 来自 武大信息学部
"findstr /i "temp1.exe temp2.exe" tasklist.txt"很必要吗?
第3楼 ccwan 发表于 2007-01-13 23:20
金牌会员 发帖 1,160 积分 2,725 来自 河北廊坊
提一小点吧,用del删除文件不必非要先去除属性,/a 参数就够用了。
第4楼 vkill 发表于 2007-01-14 03:05
金牌会员 发帖 1,744 积分 4,103 来自 甘肃.临泽
楼主改改,用tasklist|find更好点
第5楼 Eblis 发表于 2007-01-14 11:25
中级用户 发帖 108 积分 251 来自 湖南==>广州
谢谢楼上几位的提醒....
确实没必要先查看进程里是否有进程..直接结束就算没有也没什么..
也没有必要去除属性...


现已改好..如果还有问题..或者可以简化的请提出..

Thank you

@echo off
echo 此程序用于删除右键自动播放的svchost.exe病毒
echo 请稍等.....正在删除病毒文件


::首先结束病毒进程
taskkill /f /im temp1.exe /im temp2.exe >nul 2>nul


::删除病毒启动注册表和盘符自动播放
:delreg
reg delete "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows" /v

"load" /f >nul 2>nul
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows" /v "load"

/t REG_SZ /d "" /f >nul 2>nul
reg export "hkcu\software\microsoft\windows\currentversion\explorer\mountpoints2"

delreg.reg >nul 2>nul
find /i "autorun" delreg.reg >temp.txt
for /f "skip=2 tokens=8 delims=\" %%a in (temp.txt) do reg delete

HKCU\software\microsoft\windows\currentversion\explorer\mountpoints2\%%a\AUTORUN /f
del delreg.reg
del temp.txt


::删除病毒文件
:del
for %%l in (%systemroot% %systemroot%\system32) do (
for %%m in (autorun.inf host.exe copy.exe temp1.exe temp2.exe) do
del %%l\%%m /f /a >nul 2>nul
)
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 (
%%i: >nul 2>nul||if errorlevel=1 goto ok
for %%j in (autorun.inf host.exe copy.exe folder.exe) do
del %%i:\%%j /f /a >nul 2>nul

)



:ok
@echo 删除完成...按任意键退出
pause >nul
goto :eof
第6楼 PPdos 发表于 2007-01-14 16:15
高级用户 发帖 268 积分 783
支持 鼓励!FOR /R
第7楼 ytfsse 发表于 2007-01-15 10:16
新手上路 发帖 6 积分 11
不错呀
第8楼 xiaohacker 发表于 2007-01-15 10:20
初级用户 发帖 45 积分 110
yuhaomiao
好东西!现在这个病毒很是猖狂!下载一个很是值得!谢谢!
[ 联系联盟系统管理团队 - 中国DOS联盟 - 标准版 ]
Sponsored by ifanr Inc | © 2001–2023