|
flying008
中级用户
  
积分 245
发帖 103
注册 2006-6-30
状态 离线
|
『楼 主』:
[已解决]批处理删除硬盘上所有同名特定文件病毒
使用 LLM 解释/回答一下
各位好!
偶的机子是XP,有CDEFGH几个盘,现在由于机子中了毒,格式化C盘后重新安装了系统,但其它盘的各个子目录和子文件夹下均有_desktop.ini文件(这是个病毒),文件本身具有《隐藏,只读,系统》属性,直接删除不掉,偶不可能一个个的在命令行模式下手动删除,所以请教如何写个批处理来通杀掉硬盘上的所有这个_desktop.ini (偶这里要请教的是批处理的语法,专杀病毒工具软件不在讨论之列, 另外请版主不要删贴,因为偶已经搜索了相关贴子,均不能彻底解决这个问题,所以才发新贴请教,请原谅!)
@echo off
for %%i ('_desktop.ini') --------- do attrib -r -a -h -s _desktop.ini & del _desktop.ini
pause
exit
思路是先查找硬盘上所有分区子目录下的各个文件夹内的_desktop.ini文件,找到后用ATTRIB来改变它们的属性,紧接着用DEL删除掉这个文件,这样在硬盘上就不会再有这个病毒了,请各位赐教---------谢谢!
值得注意的是路径中肯定会有中文路径或带有空格的路径的,诚候指教-------
另外想问的是,如果系统是WIN2000,这个批处理是否同样适用?
Last edited by flying008 on 2006-9-20 at 20:27 ]
Hello everyone!
My computer is XP, with disks C, D, E, F, G, H, etc. Now, because the computer was infected with a virus, I formatted the C drive and reinstalled the system, but there are _desktop.ini files (this is a virus) in various subdirectories and subfolders of other disks. The files themselves have the attributes "Hidden, Read-only, System", and they cannot be directly deleted. I can't delete them one by one in the command line mode, so I ask how to write a batch script to kill all this _desktop.ini on the hard drive. (What I am asking for here is the syntax of the batch script. The special virus-killing tool software is not in the discussion. Also, please don't delete the post, because I have searched relevant posts and can't completely solve this problem, so I posted a new post to ask for advice, please forgive me!)
@echo off
for %%i ('_desktop.ini') --------- do attrib -r -a -h -s _desktop.ini & del _desktop.ini
pause
exit
The idea is to first find all _desktop.ini files in the subdirectories of each partition on the hard drive, and after finding them, use ATTRIB to change their attributes, and then use DEL to delete this file, so that there will be no more of this virus on the hard drive. Please give me your advice---------Thank you!
It is worth noting that there must be Chinese paths or paths with spaces in the path. I am waiting for your advice---------
Also, I want to ask, if the system is WIN2000, will this batch script be applicable?
Last edited by flying008 on 2006-9-20 at 20:27 ]
|
|
2006-9-20 07:26 |
|
|
flying008
中级用户
  
积分 245
发帖 103
注册 2006-6-30
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
虽然WINDWOS下的FIND查找功能或许可以实现同类功能,但偶是诚心求教批处理的语法并学习,请各位不吝赐教------
Although the FIND search function under WINDWOS may be able to achieve similar functions, I am sincerely seeking the syntax of batch processing and learning, please give your advice without sparing------
|
|
2006-9-20 07:30 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
以下代码可以在全盘删除所有文件夹下的_desktop.ini,而不管它具备何种属性。
@echo off
setlocal enabledelayedexpansion
for /f "delims=\" %%i in ('fsutil fsinfo drives^|find /v ""') do (
set var=%%i
set drive=!var:~-2!
fsutil fsinfo drivetype !drive!|find "固定">nul && del /a /f /s !drive!\_desktop.ini
)
pause
The following code can delete _desktop.ini in all folders on the entire disk regardless of its attributes.
@echo off
setlocal enabledelayedexpansion
for /f "delims=\" %%i in ('fsutil fsinfo drives^|find /v ""') do (
set var=%%i
set drive=!var:~-2!
fsutil fsinfo drivetype !drive!|find "Fixed">nul && del /a /f /s !drive!\_desktop.ini
)
pause
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2006-9-20 07:43 |
|
|
electronixtar
铂金会员
      
积分 7493
发帖 2672
注册 2005-9-2
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
Namejm的代码太强悍了,都fsutil fsinfo drivetype !drive!|find "固定",呵呵
The code of Namejm is too powerful. It's all fsutil fsinfo drivetype !drive!|find "Fixed", heh heh
|

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>" |
|
2006-9-20 08:05 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
抄袭某个毒王的代码,呵呵。
Copying the code of some virus maker, heh heh.
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2006-9-20 08:06 |
|
|
pengfei
银牌会员
    
积分 1218
发帖 485
注册 2006-7-21 来自 湖南.娄底
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
强!!! 先列出所有硬盘盘符, 再删指定文件.
Last edited by pengfei on 2006-10-14 at 09:30 ]
Strong!!! First list all hard disk drive letters, then delete the specified file.
Last edited by pengfei on 2006-10-14 at 09:30 ]
|

业精于勤而荒于嬉,形成于思而毁于随。 |
|
2006-9-20 08:09 |
|
|
kennyfan
中级用户
  
积分 259
发帖 112
注册 2006-9-18
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
用这寸代码搞搞其他文件也不错哦!呵呵!
Using this piece of code to mess with other files is not bad either! Hehe!
|
|
2006-9-20 08:14 |
|
|
electronixtar
铂金会员
      
积分 7493
发帖 2672
注册 2005-9-2
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
提示下:个人经验认为:没有纯文件病毒。一般都还感染注册表的
Tips: Personal experience suggests that: There are no pure file viruses. Generally, they still infect the registry
|

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>" |
|
2006-9-20 08:29 |
|
|
fastslz
铂金会员
       DOS一根葱
积分 5493
发帖 2315
注册 2006-5-1 来自 上海
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
恩病毒不感染注册表也不成病毒了。楼主的此类病毒一般是靠光盘U盘传播的,所以组策略里关闭自动播放相当重要的!
The En virus won't be a virus if it doesn't infect the registry. The viruses of this type by the thread starter generally spread via CDs and USB drives, so it's quite important to disable autoplay in the group policy!
|

第一高手 第二高手
我的小站
 |
|
2006-9-20 09:50 |
|
|
flying008
中级用户
  
积分 245
发帖 103
注册 2006-6-30
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
已经解决了!!!
1、首先在这里真诚感谢namejm! 是你的代码和帮助让偶成功实现杀毒和学习语法。
2、同时也感谢所有看贴和回贴指教的大大以及DOS联盟的会员!
3、to electronixtar :偶已经恢复系统了,所以系统盘的注册表不存在这类感染问题,谢谢你的提醒。
to fastslz : 偶已经在组策略里禁止了autorun,谢谢你!在偶初来论坛的时候,就有你和electronixtar及BagPipe等高手的帮助,谢谢你们!
It has been solved!!!
1. First of all, I sincerely thank namejm here! It is your code and help that enabled me to successfully realize virus killing and learn grammar.
2. At the same time, I thank all the great people who read the post and gave advice and the members of the DOS Union!
3. To electronixtar: I have restored the system, so there is no such infection problem in the registry of the system disk. Thank you for your reminder.
To fastslz: I have prohibited autorun in the group policy. Thank you! When I first came to the forum, there were your help as well as the help of electronixtar and BagPipe and other experts. Thank you all!
|
|
2006-9-20 20:20 |
|
|
3742668
荣誉版主
      
积分 2013
发帖 718
注册 2006-2-18
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
wmic datafile where "filename='desktop' and Extension='ini'" call delete /NOINTERACTIVE
wmic datafile where "filename='desktop' and Extension='ini'" call delete /NOINTERACTIVE
|
|
2006-9-22 00:53 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
3742668版主一句话就搞定了,厉害。什么时候能给我们讲解一下wmic的用法就好了。
顺便指出一下版主的疏忽之处:楼主需要把_desktop.ini删掉,而不是desktop.ini,呵呵,一个符号的差异。
Version 3742668, the moderator solved it with just one sentence, impressive. When can you explain the usage of wmic for us?
By the way, point out the moderator's oversight: the original poster needs to delete _desktop.ini, not desktop.ini, heh, a difference of one symbol.
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2006-9-22 00:58 |
|
|
pengfei
银牌会员
    
积分 1218
发帖 485
注册 2006-7-21 来自 湖南.娄底
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
3742668版主和namejm兄的代码太强悍了, 怎么也看不懂, 呵呵~ 向你们学习.
我就贴一段大家都看的懂的代码吧! 也是全盘强制删除_desktop.ini文件:
@echo off
if exist "%tmp%\note.txt" del /a "%tmp%\note.txt" >nul 2>nul
set num=0
setlocal enabledelayedexpansion
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 (
if exist %%i: (
cd\
for /f "tokens=*" %%a in ('dir /s /a-d /b %%i:\_desktop.ini') do (
echo %%a>>"%tmp%\note.txt"
set /a num=!num!+1
del /q /a /f "%%a"
)
)
)
cls
echo 共删除文件: %num%个
pause
if not "%num%"=="0" start "" "%tmp%\note.txt"
Last edited by pengfei on 2006-9-23 at 08:27 ]
The 3742668 moderator and brother namejm's code is too powerful, I can't understand it at all, heh heh~ Learning from you.
I'll just post a section of code that everyone can understand! It's also to force delete the _desktop.ini file throughout the disk:
@echo off
if exist "%tmp%\note.txt" del /a "%tmp%\note.txt" >nul 2>nul
set num=0
setlocal enabledelayedexpansion
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 (
if exist %%i: (
cd\
for /f "tokens=*" %%a in ('dir /s /a-d /b %%i:\_desktop.ini') do (
echo %%a>>"%tmp%\note.txt"
set /a num=!num!+1
del /q /a /f "%%a"
)
)
)
cls
echo Total deleted files: %num%
pause
if not "%num%"=="0" start "" "%tmp%\note.txt"
Last edited by pengfei on 2006-9-23 at 08:27 ]
|

业精于勤而荒于嬉,形成于思而毁于随。 |
|
2006-9-22 01:35 |
|
|
bosskof
初级用户
 
积分 22
发帖 11
注册 2006-5-11
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
为什么不在盘符下 del /s/a _desktop.ini ? del /?
Why not del /s/a _desktop.ini under the drive letter? del /?
|
|
2006-9-22 05:10 |
|
|
vkill
金牌会员
     
积分 4103
发帖 1744
注册 2006-1-20 来自 甘肃.临泽
状态 离线
|
|
2006-9-22 07:31 |
|