|
woof
新手上路
 神話
积分 12
发帖 5
注册 2006-11-22
状态 离线
|
『楼 主』:
求一個自動刪除文件夾內所有內容的腳本
使用 LLM 解释/回答一下
如題,我用del /q /s /arh filename
但是如果是文件夾或者隱藏並只讀文件久刪不掉,青問該怎麼做,謝謝
As the title says, I use del /q /s /arh filename. But if it's a folder or a hidden and read-only file that can't be deleted, how should I do it? Thanks.
|
|
2006-11-22 22:43 |
|
|
afeichai
初级用户
 
积分 171
发帖 78
注册 2006-11-22
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
用RD /q/s 试试
如果还要保留文件夹,可以用MD重建
Try using RD /q/s. If you still need to keep the folder, you can recreate it with MD.
|
|
2006-11-22 22:49 |
|
|
woof
新手上路
 神話
积分 12
发帖 5
注册 2006-11-22
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
這個只是刪除目錄而已,我現在市場普通的文件,如果同時是隱藏的並且是只讀的,久刪不掉,只有把/s/q去掉財可以,但這樣的話普通的文件久刪不掉拉
This is just deleting the directory. Now I'm dealing with ordinary files. If they are both hidden and read-only, they can't be deleted. Only by removing /s/q can it be deleted, but in that case, ordinary files can't be deleted either.
|
|
2006-11-22 23:12 |
|
|
redtek
金牌会员
     
积分 2902
发帖 1147
注册 2006-9-21
状态 离线
|
    『第 4 楼』:
使用 LLM 解释/回答一下
RMDIR /S /Q 你要删除的目录名
(目录内有只读和隐藏属性的文件照样可以连同目录一起被删掉,已验证)
(但,这个要被删的目录内不得有正在运行的或被系统“占用”的文件,则可以删掉)
删除的时候必须在你要删除的目录名之外删除才可以删掉:)
如果你在删除一个目录名为:ABC ,但你此时又在这个 ABC 的目录内,则这个目录正被你使用(占用),所以删不掉。
删掉目录以后,可以再重建一个同名的目录,这样就相当于删掉了这个目录内的所以文件。
这样操作只是为了 “省事儿” 而已:)
) 上面方法是省事儿的方法,即删掉目标目录下的所有文件以及子目录,然后重建。
) 同时,上面原理操作我已经在我的机器上模拟建了一个目录,这个目录为隐藏+只读。
同时,这个目录内建了若干子目录,全为隐藏+只读,
同时,这些子目录内又建了n个文件,文件属性全为隐藏+只读
然后,我在这个要删的目录的上级一目录执行 RMDIR /S /Q 我要删的这个目录名。
测试成功!(测试环境:Windows Server 2003 CMD Shell)
Last edited by redtek on 2006-11-22 at 10:55 AM ]
RMDIR /S /Q the directory name you want to delete
(Files with read-only and hidden attributes in the directory can still be deleted along with the directory, which has been verified)
(However, the directory to be deleted must not have files that are running or "occupied" by the system, then it can be deleted)
You must delete outside the directory name you want to delete to be able to delete it:)
If you are deleting a directory named: ABC, but you are in this ABC directory at this time, then this directory is being used (occupied) by you, so it cannot be deleted.
After deleting the directory, you can re-create a directory with the same name, which is equivalent to deleting all the files in this directory.
This operation is just to be "省事" (save effort):)
) The above method is a time-saving method, that is, delete all files and subdirectories under the target directory, and then re-create.
) At the same time, I have simulated and built a directory on my machine according to the above principle operation. This directory is hidden + read-only.
At the same time, several subdirectories are built in this directory, all hidden + read-only,
At the same time, n files are built in these subdirectories, and the file attributes are all hidden + read-only
Then, I execute RMDIR /S /Q the directory name I want to delete in a directory above the directory to be deleted.
The test was successful! (Test environment: Windows Server 2003 CMD Shell)
Last edited by redtek on 2006-11-22 at 10:55 AM ]
此帖被 +5 点积分 点击查看详情 评分人:【 ccwan 】 | 分数: +3 | 时间:2006-11-23 00:06 | 评分人:【 woof 】 | 分数: +1 | 时间:2006-11-23 02:43 | 评分人:【 hxuan999 】 | 分数: +1 | 时间:2006-11-24 06:54 |
|
|

Redtek,一个永远在网上流浪的人……
_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._ |
|
2006-11-22 23:50 |
|
|
ccwan
金牌会员
     
积分 2725
发帖 1160
注册 2006-9-23 来自 河北廊坊
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
redtek兄讲解问题耐心细致,并亲做测试,态度诚恳。欣赏,加分。
Brother redtek explained the problem patiently and carefully, and did tests himself, with a sincere attitude. Appreciate it, add points.
|

三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。 |
|
2006-11-23 00:08 |
|
|
不得不爱
超级版主
         我爱DOS
积分 5310
发帖 2044
注册 2005-9-26 来自 四川南充
状态 离线
|
|
2006-11-23 00:18 |
|
|
woof
新手上路
 神話
积分 12
发帖 5
注册 2006-11-22
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
Originally posted by 不得不爱 at 2006-11-22 11:18 AM:
del /q /s /f filename
就可以刪除文件夾內所有內容,包括隱藏並只讀文件。如果是文件夾就不会刪除
舉個例子
如果刪除temp文件夾下所有文件
del /q /s /f temp
結果是如果這個文件夾下有個隱藏且只讀的文件就不可以刪除
我的系統是繁體winxp sp1,
Originally posted by Must Love at 2006-11-22 11:18 AM:
del /q /s /f filename
You can delete all contents in the folder, including hidden and read-only files. If it is a folder, it will not be deleted
For example
If you want to delete all files in the temp folder
del /q /s /f temp
The result is that if there is a hidden and read-only file in this folder, it cannot be deleted
My system is Traditional Chinese Windows XP SP1,
|
|
2006-11-23 02:25 |
|
|
afeichai
初级用户
 
积分 171
发帖 78
注册 2006-11-22
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
我是这样做的
@RD /q/s %Temp%
@MD %Temp%
在XPSP2和2003SP1都可以实现
This is what I did
@RD /q/s %Temp%
@MD %Temp%
It can be realized in XPSP2 and 2003SP1
|
|
2006-11-23 02:29 |
|
|
不得不爱
超级版主
         我爱DOS
积分 5310
发帖 2044
注册 2005-9-26 来自 四川南充
状态 离线
|
|
2006-11-23 02:37 |
|
|
redtek
金牌会员
     
积分 2902
发帖 1147
注册 2006-9-21
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
Windows系统指定的临时文件存储目录有个: 2006-11-22 13:44 <DIR> Temporary Internet Files
如果你执行: rmdir /s /q "Temporary Internet Files" 命令,则删不掉某些文件。
因为这些文件是正在被打开使用的文件。
如果正在被打开使用的系统文件也能删掉的话,这也太不全安了吧?哈哈……
Temporary Internet Files\Content.IE5\9KVUC49T\zh-CN - 另一个程序正在使用此文件,进程无法访问。
Temporary Internet Files\Content.IE5\index.dat - 另一个程序正在使用此文件,进程无法访问。
但是,当我关掉IE浏览器以后,我再执行: rmdir /s /q "Temporary Internet Files" 命令
就会发现现在只剩一个文件删不掉了:)
Temporary Internet Files\Content.IE5\index.dat - 另一个程序正在使用此文件,进程无法访问。
正在被打开和正在被系统使用的文件是不能被一般情况下删除的,这是系统为了安全考虑:)
Last edited by redtek on 2006-11-22 at 01:52 PM ]
There is a directory for temporary file storage specified by the Windows system: 2006-11-22 13:44 <DIR> Temporary Internet Files
If you execute the command: rmdir /s /q "Temporary Internet Files", some files cannot be deleted.
Because these files are files that are currently being opened and used.
If system files that are currently being opened and used could also be deleted, that would be too insecure, haha...
Temporary Internet Files\Content.IE5\9KVUC49T\zh-CN - The process cannot access the file because another program is using it.
Temporary Internet Files\Content.IE5\index.dat - The process cannot access the file because another program is using it.
But when I close the IE browser, and then I execute the command: rmdir /s /q "Temporary Internet Files"
I will find that now only one file cannot be deleted :)
Temporary Internet Files\Content.IE5\index.dat - The process cannot access the file because another program is using it.
Files that are currently being opened and used by the system cannot be generally deleted, which is for the sake of system security :)
Last edited by redtek on 2006-11-22 at 01:52 PM ]
|

Redtek,一个永远在网上流浪的人……
_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._ |
|
2006-11-23 02:47 |
|
|
woof
新手上路
 神話
积分 12
发帖 5
注册 2006-11-22
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
加個-a就可以了,OK,謝謝,
但文件夾怎麼拌啊?只有在加一個命令?
有沒有一個命令可以刪掉所有文件,(包括文件夾),但不刪除目錄本身
謝謝打架
Just add -a, OK, thanks. But what about the folder? Just add another command? Is there a command to delete all files (including folders) but not delete the directory itself? Thanks everyone
|
|
2006-11-23 02:51 |
|
|
electronixtar
铂金会员
      
积分 7493
发帖 2672
注册 2005-9-2
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
能删除掉 index.dat 的,说明你的技术不是一般的高啦。
Those who can delete index.dat must have really high skills.
|

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-11-23 07:05 |
|
|
tao0610
高级用户
    朦胧的世界
积分 579
发帖 218
注册 2006-10-24
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
index.dat可以在DOS下清除,或者用别的帐号登陆也可以清除!
软件用Tracks Eraser Pro也可以。
不过为了点历史记录这么大费周章没必要(除了你被黑客盯上,或者在做什么不法事情)
index.dat can be cleared under DOS, or you can log in with another account to clear it! The software Tracks Eraser Pro can also be used. But it's not necessary to go to so much trouble for a little history (unless you're being targeted by hackers or doing something illegal)
|

认识自己,降伏自己,改变自己,才能改变别人! |
|
2006-11-23 07:16 |
|
|
anqing
高级用户
   
积分 859
发帖 413
注册 2006-8-14
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
temp文件夹内的内容,有的被系统占用,无法删除,不知用什么办法,能删除它们。能不能写下bat 看看?
The contents in the temp folder, some are occupied by the system and cannot be deleted. I don't know what method can be used to delete them. Can you write a bat?
|
|
2006-11-23 07:28 |
|
|
anqing
高级用户
   
积分 859
发帖 413
注册 2006-8-14
状态 离线
|
『第 15 楼』:
使用 LLM 解释/回答一下
Originally posted by afeichai at 2006-11-23 02:29:
我是这样做的
@RD /q/s %Temp%
@MD %Temp%
在XPSP2和2003SP1都可以实现
如果temp文件夹里有程序正在占用,也能删除temp文件夹吗?
哪位能写一个vbs的脚 本,让我们学习一下?vbs脚 本的用法?
Originally posted by afeichai at 2006-11-23 02:29:
This is what I did
@RD /q/s %Temp%
@MD %Temp%
It can be implemented in XPSP2 and 2003SP1
If there are programs occupying the temp folder, can the temp folder still be deleted?
Can someone write a VBS script for us to learn? How to use the VBS script?
|
|
2006-11-23 07:32 |
|