![]() |
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-09-13 23:10 |
47,812 topics / 349,916 posts / today 0 new / 48,268 members |
| 论坛回收站 » Please provide the specific program code or relevant content that needs to be modified so that I can assist you in modifying it. |
| Printable Version 2,007 / 5 |
| Floor1 zqdarkday | Posted 2007-11-14 12:01 |
| 中级用户 Posts 79 Credits 210 From 湖北 | |
|
Recently I practiced writing a small program to kill USB flash drive viruses, but I found a problem.
The specific code is as follows @echo off cls cd\ color fc echo Is using this program, please wait... echo To prevent your mobile storage device from being infected again, so I have created a few folders for you. They are not viruses, please rest assured! set m=autorun.inf for /f "skip=1 tokens=1,2* delims==" %%a in (autorun.inf) do (set n=%%b) for /d %%c in (c d e f h i) do (if exist %%c:\%n% attrib -s -h %%c:\%n% && del /f %%c:\%n%) for /d %%d in (c d e f h i) do (if exist %%d:\%m% attrib -s -h %%d:\%m% && del /f %%d:\%m%) for /d %%e in (c d e f h i )do (md %%e:\autorun.inf & attrib +s +h %%e:\autorun.inf) for /d %%f in (c d e f h i )do (md %%f:\autorun.ini & attrib +s +h %%f:\autorun.ini) for /d %%g in (c d e f h i )do (md %%g:\autorun.exe & attrib +s +h %%g:\autorun.exe) pause If there is no autorun.inf or the specified.exe file in drives such as c d e f, del will delete all files in c d e f, and even && doesn't work. Everyone, please help me modify it. Actually, I think this is a big problem!!! [ Last edited by zqdarkday on 2007-11-14 at 12:22 PM ] |
|
| Floor2 lxmxn | Posted 2007-11-14 13:09 |
| 版主 Posts 4,938 Credits 11,386 | |
|
It should not delete all files. Did you make a mistake?
|
|
| Floor3 zqdarkday | Posted 2007-11-14 13:26 |
| 中级用户 Posts 79 Credits 210 From 湖北 | |
|
re lxmsn: I tried it and it won't delete *.*
del /f %%c:\%m% but what happens when %m% doesn't exist? What does this point to? But when a variable is empty, why does cmd still prompt? Is this the case for all? I still don't dare to del /q because it's my classmate's, afraid of deleting their stuff, hope the expert solves this problem!!! [ Last edited by zqdarkday on 2007-11-14 at 01:41 PM ] |
|
| Floor4 lxmxn | Posted 2007-11-14 13:52 |
| 版主 Posts 4,938 Credits 11,386 | |
|
del /f %%c:\%n%
When n is an empty value, it will prompt you to delete %%c:\*, which is only all the files in the root directory of %%c, not including subdirectories. You can create a judgment statement to judge whether %n% is empty, and then do the next processing. if not "%n%"=="" dosomething .... |
|
| Floor5 zqdarkday | Posted 2007-11-14 18:44 |
| 中级用户 Posts 79 Credits 210 From 湖北 | |
|
Thanks, really, all the files in the root directory. Learned it
|
|
| Floor6 sgzhou6688 | Posted 2010-05-23 13:13 |
| 中级用户 Posts 110 Credits 231 From 中国大陆 | |
|
That's not written like this呀》》》》》》》》》》》》》》》》》》.
|
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |