|
xtay1625
初级用户
 
积分 128
发帖 9
注册 2003-6-7
状态 离线
|
『楼 主』:
求助,关于用批命令删文件!!
使用 LLM 解释/回答一下
我想用一批处理命令来删除文件
文件名为:xyz.com
如何可以把指定盘符下面的所有的xyz.com给删除掉???
麻烦大家了,谢谢
I want to use a batch processing command to delete files. The file name is: xyz.com. How can I delete all xyz.com under the specified drive letter??? Thanks everyone, thank you.
|
|
2006-11-16 00:32 |
|
|
ccwan
金牌会员
     
积分 2725
发帖 1160
注册 2006-9-23 来自 河北廊坊
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
抄一个给你,不用指定,全盘删除。
@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!\xyz.com
)
pause
若要指定在c盘下,用del /a /f /s c:\xyz.com
Copy one for you, no need to specify, delete all.
@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!\xyz.com
)
pause
If you want to specify under the C drive, use del /a /f /s c:\xyz.com
|

三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。 |
|
2006-11-16 00:56 |
|
|
lxmxn
版主
       
积分 11386
发帖 4938
注册 2006-7-23
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
@echo off
set/p a=请指定要删除文件的盘符:(格式如:C:)
set/p b=请指定要删除的文件名:
for /f "delims=" %%i in ('dir /s/b/a-d %a%\%b%') do del %%i
```
@echo off
set/p a=Please specify the drive letter of the file to be deleted: (Format like: C:)
set/p b=Please specify the file name to be deleted:
for /f "delims=" %%i in ('dir /s/b/a-d %a%\%b%') do del %%i
```
|
|
2006-11-16 00:58 |
|
|
xtay1625
初级用户
 
积分 128
发帖 9
注册 2003-6-7
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
好像都不能正常删除,不过还是谢谢你们
It seems that none can be deleted normally, but still thank you all
|
|
2006-11-16 02:40 |
|
|
lxmxn
版主
       
积分 11386
发帖 4938
注册 2006-7-23
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
Originally posted by xtay1625 at 2006-11-16 02:40:
好像都不能正常删除,不过还是谢谢你们
怎么不能删除?把你的情况说一下吧,可以适当修改代码强行删除!
不能删除可能是带有系统属性或者文件正在被使用中ing……
Originally posted by xtay1625 at 2006-11-16 02:40:
It seems that none can be deleted normally, but thank you all the same
Why can't it be deleted? Let's talk about your situation. The code can be appropriately modified to force deletion!
It may not be deleted because it has a system attribute or the file is being used...
|
|
2006-11-16 02:44 |
|
|
ccwan
金牌会员
     
积分 2725
发帖 1160
注册 2006-9-23 来自 河北廊坊
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
为什么不能正常删除?请说明情况。
Why can't it be deleted normally? Please describe the situation.
|

三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。 |
|
2006-11-16 02:44 |
|
|
redtek
金牌会员
     
积分 2902
发帖 1147
注册 2006-9-21
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
不能正常删除的原因是要删的文件在含有空格的目录里~:)
一定是忘记写“引号”了,哈哈~:)
DEL "%%i"
……
不会又是要删那个“威金”病毒吧?(那东东还感染可执行文件~:)
病毒官方网站上直接下载专杀这个病毒的工具:)
Last edited by redtek on 2006-11-16 at 02:58 AM ]
The reason for the inability to delete normally is that the file to be deleted is in a directory with spaces ~:)
It must be that the "quotes" were forgotten to be written, haha ~:)
DEL "%%i"
……
Could it be that it's going to delete that "Viking" virus again? (That thing still infects executable files ~:)
Directly download the tool to specifically kill this virus from the virus official website ~:)
Last edited by redtek on 2006-11-16 at 02:58 AM ]
|

Redtek,一个永远在网上流浪的人……
_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._ |
|
2006-11-16 02:55 |
|
|
ccwan
金牌会员
     
积分 2725
发帖 1160
注册 2006-9-23 来自 河北廊坊
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
redtek兄说得是,我一开始也是总忽略“”,经过大家提醒才有所改进。
一句话……细节决定成败!
Brother redtek is right. I always ignored the "" at first, and only improved after everyone's reminder. A single sentence... Details determine success or failure!
|

三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。 |
|
2006-11-16 03:15 |
|
|
NaturalJ0
银牌会员
    
积分 1181
发帖 533
注册 2006-8-14
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
del /s /f xyz.com
可以么?
Is it okay to use del /s /f xyz.com?
|
|
2006-11-16 03:33 |
|
|
lxmxn
版主
       
积分 11386
发帖 4938
注册 2006-7-23
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
呵呵,还真没注意这个小细节了。
Hehe, I really didn't notice this small detail.
|
|
2006-11-16 03:37 |
|
|
ccwan
金牌会员
     
积分 2725
发帖 1160
注册 2006-9-23 来自 河北廊坊
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
Originally posted by NaturalJ0 at 2006-11-16 03:33:
del /s /f xyz.com
可以么?
似乎只支持当前路径。
试了一下,当批处理在根目录时完全可以,若在下一级目录则不能删除上级目录中的文件。
Last edited by ccwan on 2006-11-16 at 03:52 AM ]
Originally posted by NaturalJ0 at 2006-11-16 03:33:
del /s /f xyz.com
Is this okay?
It seems to only support the current path.
Tried it. When the batch file is in the root directory, it works completely. But if it's in a subdirectory, it can't delete files in the parent directory.
Last edited by ccwan on 2006-11-16 at 03:52 AM ]
|

三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。 |
|
2006-11-16 03:45 |
|
|
lxmxn
版主
       
积分 11386
发帖 4938
注册 2006-7-23
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
Originally posted by ccwan at 2006-11-16 03:45:
似乎只支持当前路径。
试了一下,当批处理在根目录时完全可以,若在下一级目录则不能删除上级目录中的文件。
Last edited by ccwan on 2006-1 ...
加上一个盘符即可:del /s/f c:\abc.cba
Originally posted by ccwan at 2006-11-16 03:45:
It seems to only support the current path.
Tried it, when the batch file is in the root directory, it works completely, but if it is in a subdirectory, it cannot delete files in the parent directory.
Last edited by ccwan on 2006-1 ...
Just add a drive letter: del /s/f c:\abc.cba
|
|
2006-11-16 03:55 |
|
|
NeverLand
初级用户
 
积分 28
发帖 11
注册 2006-11-17
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
Originally posted by lxmxn at 2006-11-15 03:55 PM:
加上一个盘符即可:del /s/f c:\abc.cba
试过了,可以
Originally posted by lxmxn at 2006-11-15 03:55 PM:
Add a drive letter: del /s/f c:\abc.cba
Tried it, works
|
|
2006-11-21 01:00 |
|
|
wu9910
初级用户
 
积分 28
发帖 13
注册 2006-11-8
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
for %%i in (xyz.com) do del c:\%%i /a/s/f
for %%i in (xyz.com) do del d:\%%i /a/s/f
for %%i in (xyz.com) do del e:\%%i /a/s/f
for %%i in (xyz.com) do del f:\%%i /a/s/f
for %%i in (xyz.com) do del g:\%%i /a/s/f
渣都没有了
不过隐藏的文件甲里,我没有办法.
我是菜鸟,不要见笑,可以帮我简化吗?dos下del没有/s的指令,请高手
指点.
Last edited by wu9910 on 2006-11-21 at 01:35 AM ]
for %%i in (xyz.com) do del c:\%%i /a/s/f
for %%i in (xyz.com) do del d:\%%i /a/s/f
for %%i in (xyz.com) do del e:\%%i /a/s/f
for %%i in (xyz.com) do del f:\%%i /a/s/f
for %%i in (xyz.com) do del g:\%%i /a/s/f
There's nothing left.
But in the hidden file folder, I can't do anything.
I'm a newbie, don't laugh at me. Can you simplify it? There's no /s command for del in DOS, please give me some advice, expert.
Last edited by wu9910 on 2006-11-21 at 01:35 AM ]
|
|
2006-11-21 02:41 |
|
|
tao0610
高级用户
    朦胧的世界
积分 579
发帖 218
注册 2006-10-24
状态 离线
|
『第 15 楼』:
使用 LLM 解释/回答一下
Originally posted by wu9910 at 2006-11-21 02:41 AM:
for %%i in (xyz.com) do del c:\%%i /a/s/f
for %%i in (xyz.com) do del d:\%%i /a/s/f
for %%i in (xyz.com) do del e:\%%i /a/s/f
for %%i in (xyz.com) do del f:\%%i /a/s/f
for %%i in (xyz.com) do d ...
简单问题复杂话。。。。
Originally posted by wu9910 at 2006-11-21 02:41 AM:
for %%i in (xyz.com) do del c:\%%i /a/s/f
for %%i in (xyz.com) do del d:\%%i /a/s/f
for %%i in (xyz.com) do del e:\%%i /a/s/f
for %%i in (xyz.com) do del f:\%%i /a/s/f
for %%i in (xyz.com) do d ...
Making a simple problem complicated...
|

认识自己,降伏自己,改变自己,才能改变别人! |
|
2006-11-21 03:07 |
|