|
plp626
银牌会员
     钻石会员
积分 2278
发帖 1020
注册 2007-11-19
状态 离线
|
『第 46 楼』:
删除任意畸形目录
使用 LLM 解释/回答一下
不知为啥代码稍一精简就出错,有个bug还是没消除(不过不容易碰到),有时间再弄吧, 把我给测试晕了,谁有耐心,就慢慢调试吧.
对付10楼那类畸形文件带点目录内含"空参目录",不管有多深!
(放在畸形目录所在路径下运行),这个代码目前没有发现bug
@echo off&mode con lines=2 cols=15
for /f "delims=" %%a in ('dir/ad/s/b^|findstr /e "\."') do (
set a=%%a
setlocal enabledelayedexpansion
call set a=!!a:%%~dpa=!!
call :nul "!a!" "%%~dpa"
popd
)
goto :eof
:nul
pushd %2 2>nul||(echo &del +&goto :eof)
rd /q/s "%b%%~1.\">+ 2>&1
find "\" +>nul||(del +&goto :eof)
for /f %%b in ('sort /r +') do rd/q/s "%%b\" 2>nul
goto nul
任意的畸形目录:"空参目录"内含带点目录以及反者(放在畸形目录所在路径下运行)
@echo off
::ntfs格式下测试,
for /f "delims=" %%a in ('dir/ad/s/b^|findstr /e "\."') do (
set a=%%a
setlocal enabledelayedexpansion
call set a=!!a:%%~dpa=!!
call :nul "!a!" "%%~dpa"
popd
)
pause
goto :eof
:nul
pushd %2 2>nul||call :con %*
:nul1
rd /q/s "%b%%~1.\">+ 2>&1
find "\" +>nul||(del +&goto :eof)
for /f %%b in ('sort /r +') do rd/q/s "%%b\" 2>nul
goto nul
:con
set b=%2
call set b=!!b:%~dp0=!!
goto nul1
Last edited by plp626 on 2008-3-14 at 08:43 PM ]
I don't know why the code has an error as soon as it is simplified a bit. There is still a bug that hasn't been eliminated (but it's not easy to encounter). I'll deal with it when I have time. It confused me in testing. Whoever has patience can debug it slowly.
Deal with the "empty parameter directory" in the deformed file with a bit of directory as in floor 10, no matter how deep it is!
(Run it in the path where the deformed directory is located). There is currently no bug found in this code
@echo off&mode con lines=2 cols=15
for /f "delims=" %%a in ('dir/ad/s/b^|findstr /e "\."') do (
set a=%%a
setlocal enabledelayedexpansion
call set a=!!a:%%~dpa=!!
call :nul "!a!" "%%~dpa"
popd
)
goto :eof
:nul
pushd %2 2>nul||(echo &del +&goto :eof)
rd /q/s "%b%%~1.\">+ 2>&1
find "\" +>nul||(del +&goto :eof)
for /f %%b in ('sort /r +') do rd/q/s "%%b\" 2>nul
goto nul
Any deformed directory: "empty parameter directory" contains directories with dots and reversers (run it in the path where the deformed directory is located)
@echo off
::Test under ntfs format,
for /f "delims=" %%a in ('dir/ad/s/b^|findstr /e "\."') do (
set a=%%a
setlocal enabledelayedexpansion
call set a=!!a:%%~dpa=!!
call :nul "!a!" "%%~dpa"
popd
)
pause
goto :eof
:nul
pushd %2 2>nul||call :con %*
:nul1
rd /q/s "%b%%~1.\">+ 2>&1
find "\" +>nul||(del +&goto :eof)
for /f %%b in ('sort /r +') do rd/q/s "%%b\" 2>nul
goto nul
:con
set b=%2
call set b=!!b:%~dp0=!!
goto nul1
Last edited by plp626 on 2008-3-14 at 08:43 PM ]
|

山外有山,人外有人;低调做人,努力做事。
进入网盘(各种工具)~~ 空间~~cmd学习 |
|
2008-3-9 16:36 |
|
|
plp626
银牌会员
     钻石会员
积分 2278
发帖 1020
注册 2007-11-19
状态 离线
|
『第 47 楼』:
使用 LLM 解释/回答一下
想想真是没事整事,吃多了撑得,想构造一个bug都很难,我就不相信病毒有多变态.
轻轻一点,一切搞定,
回523066680,46楼第2个的代码基本上可以干掉所有可见带点畸形目录.
请测试.(确实有bug但...)
Last edited by plp626 on 2008-3-9 at 06:17 PM ]
It just feels like doing something needless, having eaten too much and having nothing to do, it's hard to construct a bug, I just don't believe how vicious viruses can be.
With a light click, everything is done,
Reply to 523066680, the code in the 2nd position of floor 46 can basically get rid of all visible abnormal directories with dots.
Please test. (There are indeed bugs but...)
Last edited by plp626 on 2008-3-9 at 06:17 PM ]
|

山外有山,人外有人;低调做人,努力做事。
进入网盘(各种工具)~~ 空间~~cmd学习 |
|
2008-3-9 18:16 |
|
|
plp626
银牌会员
     钻石会员
积分 2278
发帖 1020
注册 2007-11-19
状态 离线
|
『第 48 楼』:
使用 LLM 解释/回答一下
总结:
最坏的情况就是根目录树下有大量病态的深层的畸形目录,最深层为"空参目录"
为了不时自己盘内的文件随这些目录一起殉葬,就不能直接从最外层目录,用rd/q/s 来删,若有可用文件在空参目录内,那就先把这些文件移出来:(见下面的帖子----文件抽取)
http://www.cn-dos.net/forum/viewthread.php?tid=38153&fpage=1&highlight=###
若你没有给这些空参目录存放文件,(大部分人都没有)那就在根目录内用46楼2代码(在根目录下双击)
其实,知道了病毒的藏身处(那就是不必考虑误删文件了),大可不必这样兴师动众,其实两条命令:
1, rd/q/s >road.txt 2>&1 ... 就获得了深层路径
2, for /f %a in ('sort /r road.txt') do rd /q/s %a\删最深层目录
然后循环1,2,直至删完所有畸形目录
像46楼的代码是自己给自己找麻烦才用得上!
Last edited by plp626 on 2008-3-10 at 12:25 AM ]
**Summary:**
The worst - case scenario is that there are a large number of pathological deep - seated abnormal directories under the root directory tree, and the deepest - seated one is an "empty parameter directory".
In order not to let the files in your own disk be buried with these directories at any time, you can't directly delete them from the outermost directory using rd/q/s. If there are available files in the empty parameter directory, first move these files out: (see the following post ---- file extraction)
http://www.cn-dos.net/forum/viewthread.php?tid=38153&fpage=1&highlight=###
If you haven't stored files in these empty parameter directories (most people haven't), then use the code in building 46 in the root directory (double - click under the root directory)
In fact, once you know the hiding place of the virus (that is, you don't need to consider mistakenly deleting files), there is no need to go to so much trouble. In fact, two commands:
1, rd/q/s >road.txt 2>&1... to obtain the deep - seated path
2, for /f %a in ('sort /r road.txt') do rd /q/s %a\ delete the deepest - seated directory
Then loop 1, 2 until all abnormal directories are deleted
Like the code in building 46, it is only useful when you are asking for trouble for yourself!
Last edited by plp626 on 2008 - 3 - 10 at 12:25 AM ]
|

山外有山,人外有人;低调做人,努力做事。
进入网盘(各种工具)~~ 空间~~cmd学习 |
|
2008-3-9 19:01 |
|
|
523066680
银牌会员
     SuperCleaner
积分 2362
发帖 1133
注册 2008-2-2
状态 离线
|
『第 49 楼』:
使用 LLM 解释/回答一下
你的探索精神!……plp626一定会前途无量的,可惜我得读书了,不能常向你学习了,你的代码里好多我都不懂的
去试了一下代码<img src="images/smilies/face-smile-big.png" align="absmiddle" border="0"> 啊牛啊!你太牛逼了!
第二段代码 第一次打开时,只删除有文件的文件夹,再打开,就把其他机型文件夹删除了,不过不会删除普通文件夹
我去给你的帖加分咯!
Last edited by 523066680 on 2008-3-15 at 06:16 PM ]
Your spirit of exploration!... plp626 is definitely going to have a bright future. It's a pity that I need to study and can't often learn from you. There are so many things in your code that I don't understand!
I tried the code :D Ah Niu ah! You're so awesome!
When opening the second code for the first time, it only deletes the folders with files. When opening again, it deletes the other model folders, but ordinary folders won't be deleted.
I'm going to add points to your post!
Last edited by 523066680 on 2008-3-15 at 06:16 PM ]
|
|
2008-3-14 18:36 |
|
|
plp626
银牌会员
     钻石会员
积分 2278
发帖 1020
注册 2007-11-19
状态 离线
|
『第 50 楼』:
使用 LLM 解释/回答一下
re: IF EXIST(已加了,o(∩_∩)o...)
对于畸形目录(空参的或带点的),不管里面再建立什么目录(资源管理器下可见),其实之一行命令即可搞定,并且立竿见影:
rd /s /q \\?\
所以对付畸形目录不必用46楼的代码了
::建立123..\nul\con\nul\目录
md 123..\ 123..\nul\ 123..\nul\con\ 123..\nul\con\nul\
::删除123.目录
rd /q/s "\\?\%cd%\123."
不过这招对资源管理器下不可见目录失效,有时间再续......
Last edited by plp626 on 2008-4-16 at 10:44 AM ]
re: IF EXIST (already added, o(∩_∩)o...)
For abnormal directories (empty parameters or with dots), no matter what directories are created inside (visible in Explorer), actually one line of command can do it, and it takes effect immediately:
rd /s /q \\?\
So there's no need to use the code from post 46 to deal with abnormal directories
::Create 123..\nul\con\nul\ directory
md 123..\ 123..\nul\ 123..\nul\con\ 123..\nul\con\nul\
::Delete 123. directory
rd /q/s "\\?\%cd%\123."
But this trick doesn't work for directories not visible in Explorer. I'll continue later...
Last edited by plp626 on 2008-4-16 at 10:44 AM ]
|

山外有山,人外有人;低调做人,努力做事。
进入网盘(各种工具)~~ 空间~~cmd学习 |
|
2008-3-21 00:35 |
|
|
523066680
银牌会员
     SuperCleaner
积分 2362
发帖 1133
注册 2008-2-2
状态 离线
|
『第 51 楼』:
回-我到你的网络硬盘搞鬼了哦
使用 LLM 解释/回答一下
::建立123..\nul\con\nul\目录
md 123..\ 123..\nul\ 123..\nul\con\ 123..\nul\con\nul\
::删除123.目录
rd /q/s \\?\%cd%\123.
这段代码我在网吧没有测试成功
同时又发现了一种畸形目录
elec……老大哥的帖说了设备为名的文件夹 我就想 盘符呢?
于是--md "c: \" 还真成了
鼠标删除的时候和别的不一样------无法读取原磁盘或文件
希望加你Q,我的523066680
Last edited by 523066680 on 2008-3-22 at 11:15 AM ]
::Create directories 123..\nul\con\nul\
md 123..\ 123..\nul\ 123..\nul\con\ 123..\nul\con\nul\
::Delete 123. directory
rd /q/s \\?\%cd%\123.
This code didn't test successfully in the internet cafe
At the same time, I found a kind of malformed directory
The old brother's post in elec... said about folders named after devices. Then I thought, what about the drive letter?
So -- md "c: \" actually worked
When deleting with the mouse, it's different from others ---- can't read the original disk or file
Hope to add your Q, my 523066680
Last edited by 523066680 on 2008-3-22 at 11:15 AM ]
|
|
2008-3-22 10:18 |
|
|
plp626
银牌会员
     钻石会员
积分 2278
发帖 1020
注册 2007-11-19
状态 离线
|
『第 52 楼』:
使用 LLM 解释/回答一下
那个是"空名"文件夹
执行
md "C: \"
相当于执行
c:&md " \"
---------------------
当然你的光标所在启动在C盘路径下,那就是在当前目录下建立" \"目录了.
That is the "empty name" folder.
Execute
md "C: \"
is equivalent to executing
c:&md " \"
---------------------
Of course, if your cursor is started in the C drive path, that is, to create a " \" directory in the current directory.
|

山外有山,人外有人;低调做人,努力做事。
进入网盘(各种工具)~~ 空间~~cmd学习 |
|
2008-3-22 15:00 |
|
|
9zhmke
中级用户
  
积分 355
发帖 99
注册 2003-1-6
状态 离线
|
『第 53 楼』:
使用 LLM 解释/回答一下
好文章,不错!在十年前曾经试过,DIR那时的访问层数只能是16层,多了就会报错,但进到16层又可以操作16层以下的内容,就是说总共是32层,好象当时用的6.0DOS,不知道现在的层数会不会还是这样。
Good article, nice! Ten years ago, I once tried. At that time, the access level of DIR could only be 16 layers. If it exceeded, it would report an error, but when entering 16 layers, you could operate the contents below 16 layers, that is to say, there were 32 layers in total. It seemed that I was using DOS 6.0 at that time. I don't know if the number of layers is still like this now.
|
|
2008-3-22 19:22 |
|
|
523066680
银牌会员
     SuperCleaner
积分 2362
发帖 1133
注册 2008-2-2
状态 离线
|
『第 54 楼』:
使用 LLM 解释/回答一下
原来是这样子啊……
对了我到你网盘放的垃圾你好像还没删掉……
你论坛主页蛮不错嘛
Last edited by 523066680 on 2008-3-23 at 11:14 AM ]
So it turns out to be like this...
By the way, the junk you put in your network disk, you haven't deleted it yet...
Your forum homepage is quite good嘛
Last edited by 523066680 on 2008-3-23 at 11:14 AM ]
|
|
2008-3-23 09:48 |
|
|
happysoul
初级用户
 
积分 29
发帖 15
注册 2008-4-14
状态 离线
|
『第 55 楼』:
使用 LLM 解释/回答一下
长见识了。。。一直都是用软件 弄那个 autorun.inf的文件夹!防止病毒~
Got it, learned something new... I've always used software to create that autorun.inf folder! To prevent viruses~
|
|
2008-4-15 19:13 |
|
|
plp626
银牌会员
     钻石会员
积分 2278
发帖 1020
注册 2007-11-19
状态 离线
|
『第 56 楼』:
使用 LLM 解释/回答一下
Originally posted by 523066680 at 2008-3-22 10:18 AM:
::建立123..\nul\con\nul\目录
md 123..\ 123..\nul\ 123..\nul\con\ 123..\nul\con\nul\
::删除123.目录
rd /q/s \\?\%cd%\123.
这段代码我在网吧没有测试成功
同时又发现 ...
你是在桌面测试的吧?空格路径要带双引号,(我忘说明,现在已更新)
Last edited by plp626 on 2008-4-16 at 10:47 AM ]
Originally posted by 523066680 at 2008-3-22 10:18 AM:
:: Create 123..\nul\con\nul\ directory
md 123..\ 123..\nul\ 123..\nul\con\ 123..\nul\con\nul\
:: Delete 123. directory
rd /q/s \\?\%cd%\123.
This code didn't work when I tested it in the internet cafe
At the same time, I found ...
Did you test it on the desktop? The space path should be with double quotes, (I forgot to mention it, now it's updated)
Last edited by plp626 on 2008-4-16 at 10:47 AM ]
|

山外有山,人外有人;低调做人,努力做事。
进入网盘(各种工具)~~ 空间~~cmd学习 |
|
2008-4-16 10:45 |
|
|
523066680
银牌会员
     SuperCleaner
积分 2362
发帖 1133
注册 2008-2-2
状态 离线
|
『第 57 楼』:
使用 LLM 解释/回答一下
……你i的话……
病毒可能比你想得还变态,
不过再变态也能干掉,我有个思路(抛砖引玉):
用2>&1来得到畸形目录的深层路径,再用for分析路径干掉所有畸形目录应该不成问题,
我的问!
2>&1 我不知道是什么来的……赐教!谢谢拉
Last edited by 523066680 on 2008-5-11 at 04:20 PM ]
……Your words……
The virus may be more perverse than you think,
But no matter how perverse it is, it can be eliminated. I have an idea (for discussion):
Use 2>&1 to get the deep path of the malformed directory, and then use for to analyze the path to eliminate all malformed directories should be no problem,
My question!
I don't know what 2>&1 is…… Please enlighten me! Thank you
Last edited by 523066680 on 2008-5-11 at 04:20 PM ]
|
|
2008-5-11 16:18 |
|
|
plp626
银牌会员
     钻石会员
积分 2278
发帖 1020
注册 2007-11-19
状态 离线
|
『第 58 楼』:
使用 LLM 解释/回答一下
2>&1 比 2> 用途广
大部分情况下二者效果一样
2>&1 is more versatile than 2>
In most cases, the effects of the two are the same
|

山外有山,人外有人;低调做人,努力做事。
进入网盘(各种工具)~~ 空间~~cmd学习 |
|
2008-5-11 17:34 |
|
|
523066680
银牌会员
     SuperCleaner
积分 2362
发帖 1133
注册 2008-2-2
状态 离线
|
『第 59 楼』:
使用 LLM 解释/回答一下
Originally posted by happysoul at 2008-4-15 07:13 PM:
长见识了。。。一直都是用软件 弄那个 autorun.inf的文件夹!防止病毒~
可以的话还是改注册表好了……免疫即使加了访问权限N,avkiller病毒也是:
强制重命名autorun.inf文件夹 然后放入自己的autorun.inf
所以 在强大的病毒面前 免疫文件夹也只是作为一个警报而已:
当发现自己的免疫不见 或被改名的时候 就……
Originally posted by happysoul at 2008-4-15 07:13 PM:
Learned something new... I've always used software to create that autorun.inf folder! To prevent viruses~
It's better to modify the registry if possible... Even with immunity, adding access rights N, the avkiller virus is still:
Forcibly renames the autorun.inf folder Then puts in its own autorun.inf
So in front of powerful viruses, the immune folder is just an alarm:
When you find that your immunity is gone or renamed then...
|
|
2008-6-29 08:43 |
|
|
422904z
初级用户
 
积分 74
发帖 37
注册 2007-6-28
状态 离线
|
『第 60 楼』:
使用 LLM 解释/回答一下
大侠请问一下,为什么在win2000 sp4 下 start c:\123.. 不能成功? xp 可以。
Great expert, may I ask why "start c:\123.." cannot succeed under win2000 sp4? It can under xp.
|
|
2008-6-30 22:26 |
|