![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-08-29 08:54 |
47,816 topics / 349,916 posts / today 0 new / 48,265 members |
| DOS批处理 & 脚本技术(批处理室) » [Solved] Batch delete virus that deletes all specific files with the same name on the hard drive |
| Printable Version 9,051 / 27 |
| Floor1 flying008 | Posted 2006-09-20 07:26 |
| 中级用户 Posts 103 Credits 245 | |
|
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 ] |
|
| Floor2 flying008 | Posted 2006-09-20 07:30 |
| 中级用户 Posts 103 Credits 245 | |
|
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------
|
|
| Floor3 namejm | Posted 2006-09-20 07:43 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
The following code can delete _desktop.ini in all folders on the entire disk regardless of its attributes.
|
|
| Floor4 electronixtar | Posted 2006-09-20 08:05 |
| 铂金会员 Posts 2,672 Credits 7,493 | |
|
The code of Namejm is too powerful. It's all fsutil fsinfo drivetype !drive!|find "Fixed", heh heh
|
|
| Floor5 namejm | Posted 2006-09-20 08:06 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
Copying the code of some virus maker, heh heh.
|
|
| Floor6 pengfei | Posted 2006-09-20 08:09 |
| 银牌会员 Posts 485 Credits 1,218 From 湖南.娄底 | |
|
Strong!!! First list all hard disk drive letters, then delete the specified file.
[ Last edited by pengfei on 2006-10-14 at 09:30 ] |
|
| Floor7 kennyfan | Posted 2006-09-20 08:14 |
| 中级用户 Posts 112 Credits 259 | |
|
Using this piece of code to mess with other files is not bad either! Hehe!
|
|
| Floor8 electronixtar | Posted 2006-09-20 08:29 |
| 铂金会员 Posts 2,672 Credits 7,493 | |
|
Tips: Personal experience suggests that: There are no pure file viruses. Generally, they still infect the registry
|
|
| Floor9 fastslz | Posted 2006-09-20 09:50 |
| 铂金会员 Posts 2,315 Credits 5,493 From 上海 | |
|
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!
|
|
| Floor10 flying008 | Posted 2006-09-20 20:20 |
| 中级用户 Posts 103 Credits 245 | |
|
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! |
|
| Floor11 3742668 | Posted 2006-09-22 00:53 |
| 荣誉版主 Posts 718 Credits 2,013 | |
| Floor12 namejm | Posted 2006-09-22 00:58 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
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. |
|
| Floor13 pengfei | Posted 2006-09-22 01:35 |
| 银牌会员 Posts 485 Credits 1,218 From 湖南.娄底 | |
|
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 ] |
|
| Floor14 bosskof | Posted 2006-09-22 05:10 |
| 初级用户 Posts 11 Credits 22 | |
|
Why not del /s/a _desktop.ini under the drive letter? del /?
|
|
| Floor15 vkill | Posted 2006-09-22 07:31 |
| 金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽 | |
|
I haven't used wmic yet
|
|
| 1 2 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |