中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

中国DOS联盟论坛
现在时间是 2026-08-03 01:03
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » 第一个批处理```请你们检查.. 查看 970 回复 7
楼 主 第一个批处理```请你们检查.. 发表于 2007-01-13 22:17 ·  中国 广东 广州 白云区 电信
中级用户
★★
积分 251
发帖 108
注册 2007-01-07 11:33
19年会员
UID 75721
性别 男
来自 湖南==>广州
状态 离线
应朋友的要求帮忙写一个删除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 发表于 2007-01-13 22:50 ·  中国 湖北 武汉 教育网
初级用户
★★
积分 129
发帖 54
注册 2007-01-04 01:03
19年会员
UID 75376
性别 男
来自 武大信息学部
状态 离线
"findstr /i "temp1.exe temp2.exe" tasklist.txt"很必要吗?
3 发表于 2007-01-13 23:20 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
积分 2,725
发帖 1,160
注册 2006-09-23 12:00
19年会员
UID 63486
来自 河北廊坊
状态 离线
提一小点吧,用del删除文件不必非要先去除属性,/a 参数就够用了。
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
4 发表于 2007-01-14 03:05 ·  中国 甘肃 甘南藏族自治州 合作市 电信
金牌会员
★★★★
积分 4,103
发帖 1,744
注册 2006-01-20 13:00
20年会员
UID 49241
性别 男
来自 甘肃.临泽
状态 离线
楼主改改,用tasklist|find更好点
5 发表于 2007-01-14 11:25 ·  中国 广东 广州 白云区 电信
中级用户
★★
积分 251
发帖 108
注册 2007-01-07 11:33
19年会员
UID 75721
性别 男
来自 湖南==>广州
状态 离线
谢谢楼上几位的提醒....
确实没必要先查看进程里是否有进程..直接结束就算没有也没什么..
也没有必要去除属性...


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

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 发表于 2007-01-14 16:15 ·  美国 弗吉尼亚州 华盛顿县 Microsoft
高级用户
★★
积分 783
发帖 268
注册 2006-12-26 17:18
19年会员
UID 74627
性别 男
状态 离线
支持 鼓励!FOR /R
7 发表于 2007-01-15 10:16 ·  中国 河南 洛阳 联通
新手上路
积分 11
发帖 6
注册 2007-01-15 08:42
19年会员
UID 76568
性别 男
状态 离线
不错呀
8 yuhaomiao 发表于 2007-01-15 10:20 ·  IANA 局域网IP(Private-Use)
初级用户
积分 110
发帖 45
注册 2007-01-07 00:00
19年会员
UID 75756
性别 男
状态 离线
好东西!现在这个病毒很是猖狂!下载一个很是值得!谢谢!
论坛跳转: