China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-25 06:50
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to use DOS commands to force delete certain files that cannot be deleted? View 4,433 Replies 15
Original Poster Posted 2008-05-27 08:34 ·  中国 天津 联通
初级用户
★★
Credits 173
Posts 69
Joined 2007-08-07 22:40
18-year member
UID 94807
Gender Male
Status Offline
How to force delete some files that cannot be deleted using DOS commands?
--------------------
Some virus files cannot be deleted under Windows. Only by using Unlocker or IceSword to solve.
But can I achieve it through DOS commands?
As long as I find this specific file name, how to force delete it.

I think that software like IceSword can achieve it. It stands to reason that it must be possible to do it through DOS commands too?
Floor 2 Posted 2008-05-27 09:00 ·  中国 湖南 株洲 电信
金牌会员
★★★★
永远的学习者
Credits 3,105
Posts 1,276
Joined 2008-03-08 13:00
18-year member
UID 112398
Gender Male
Status Offline
attrib -h -s -a a.bvf
del /s /q /f a.bvf
批处理之家新域名:www.bathome.net
Floor 3 Posted 2008-05-27 09:06 ·  中国 上海 联通
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
Repost

Invincible command replace in XP: force replacing files

The replace command used to replace files can even replace files that are in use.
For example: Create a directory under C: \, c: \aaa
Then copy an mp3 to c:\aaa and name it c:\aaa\a.mp3
Then copy another song to C:\a.mp3
Then play c:\aaa\a.mp3 with media player
Enter in the command prompt: replace c:\a.mp3 c:\aaa
After a while, isn't the played song changed to another one.
Using this command to replace system files is really cool, and the system file protection of XP is also ineffective for it.
No need to replace files in safe mode anymore
Floor 4 Posted 2008-05-27 09:23 ·  中国 天津 联通
初级用户
★★
Credits 173
Posts 69
Joined 2007-08-07 22:40
18-year member
UID 94807
Gender Male
Status Offline
Replacement isn't always usable. MP3 wasn't tried. But EXE files can't be replaced.
Floor 5 Posted 2008-05-27 09:25 ·  中国 天津 联通
初级用户
★★
Credits 173
Posts 69
Joined 2007-08-07 22:40
18-year member
UID 94807
Gender Male
Status Offline
del sometimes seems unable to delete.
I tried, sometimes unable to delete, using IceSword can. Or using Unlocker is also okay,
My purpose is to use pure DOS commands without software to solve.
Floor 6 Posted 2008-05-27 11:02 ·  中国 四川 成都 电信
中级用户
★★
Credits 297
Posts 135
Joined 2006-10-21 12:00
19-year member
UID 67627
Gender Male
Status Offline
The target file is in use, that is, locked. Unlocker or IceSword can delete it because they can remove the lock. Pure DOS commands can't do that.

I never succeeded when I tested replace...
Floor 7 Posted 2008-05-27 11:56 ·  中国 陕西 西安 电信
铂金会员
★★★★
Credits 5,212
Posts 2,478
Joined 2007-02-08 23:39
19-year member
UID 79003
Gender Male
Status Offline
Does unlocker have parameters...

ren to old
Delete after restart...
S smile 微笑,L love 爱,O optimism 乐观,R relax 放松,E enthusiasm 热情...Slore
Floor 8 Posted 2008-05-27 16:51 ·  中国 天津 联通
初级用户
★★
Credits 173
Posts 69
Joined 2007-08-07 22:40
18-year member
UID 94807
Gender Male
Status Offline
I just want to use DOS commands to achieve the function of unlocker, remove the lock, and then delete it.
Floor 9 Posted 2008-05-29 17:26 ·  中国 广东 茂名 化州市 电信
中级用户
★★
Credits 396
Posts 183
Joined 2007-12-23 06:24
18-year member
UID 106531
Gender Male
Status Offline
rd /s/q \\?\%1
del /f/a/q \\?\%1

Drag any unremovable files onto this batch icon
Floor 10 Posted 2008-05-29 17:41 ·  中国 陕西 西安 电信
银牌会员
★★★★
钻石会员
Credits 2,278
Posts 1,020
Joined 2007-11-19 13:34
18-year member
UID 103127
Gender Male
Status Offline
Originally posted by jiulong at 2008-5-29 05:26 PM:
rd /s/q \\?\%1
del /f/a/q \\?\%1

Drag any unremovable files onto this batch file icon.

In the resource manager of a fat32 partition, invisible directories cannot be deleted.
Any tool cannot delete the deepest path unless you format the disk.
When deleting files, actually IceSword is not as easy to use as rd.
山外有山,人外有人;低调做人,努力做事。

进入网盘(各种工具)~~ 空间~~cmd学习
Floor 11 Posted 2008-06-01 01:11 ·  中国 天津 联通
初级用户
★★
Credits 173
Posts 69
Joined 2007-08-07 22:40
18-year member
UID 94807
Gender Male
Status Offline
The `\\?\` prefix is a way to enable long path support in Windows. It allows paths that exceed the normal MAX_PATH limit (260 characters). `%1` is a command-line argument. So the first command `rd /s/q \\?\%1` is for forcibly removing (recursively, silently) the directory specified by the first command-line argument with long path support enabled, and the second command `del /f/a/q \\?\%1` is for forcibly deleting (with attributes, silently) the file specified by the first command-line argument with long path support enabled.
请指教,后面的 \\?\%1是什么意思呀?
Please advise, what does the following `\\?\%1` mean?
Floor 12 Posted 2008-06-09 06:01 ·  中国 上海 杨浦区 电信
中级用户
★★
Credits 248
Posts 126
Joined 2008-05-30 17:18
18-year member
UID 120118
Gender Male
Status Offline
Originally posted by plp626 at 2008-5-29 05:41 PM:

In the FAT32 partition, directories that are not visible in Windows Explorer cannot be deleted. You can't get the deepest path, and no tool can delete them unless you format the disk. When it comes to deleting files, actually, IceSword is not as easy to use as RD.


For deeply hidden directories, you can use DIR /AD /X > text file. Modify the text file, and then you can batch delete any files.
Floor 13 Posted 2010-11-07 23:38 ·  中国 湖南 长沙 电信
新手上路
Credits 7
Posts 4
Joined 2010-10-21 00:31
15-year member
UID 176226
Gender Male
From 湖南
Status Offline
You can try the rm command
Floor 14 Posted 2010-11-11 03:36 ·  中国 黑龙江 牡丹江 电信
中级用户
★★
Credits 216
Posts 129
Joined 2007-02-14 07:26
19-year member
UID 79469
Gender Male
Status Offline
XP medium-unbeatable command replace: force replacement of files

The replace used to replace files can even replace files that are in use.
For example: Create a directory under C: \, c: \aaa
Then copy an mp3 to c: \aaa and name it c: \aaa\a.mp3
Then copy another song to C:\a.mp3
Then play c: \aaa\a.mp3 with media player
Enter in the command prompt: replace c:\a.mp3 c:\aaa
After a while, is the playing song changed to another one.
It's really cool to use this command to replace system files, and the system file protection of XP is also ineffective for it.
No longer need to replace files in safe mode

This should be misinformation on the Internet. I have tried to replace system files with replace many times, but all failed
Floor 15 Posted 2010-11-12 22:07
初级用户
Credits 40
Posts 37
Joined 2009-06-24 00:38
17-year member
UID 148015
Gender Male
Status Offline
What you said is good, using DOS to solve, but you don't forget, you are using CMD, not DOS, CMD doesn't have that high authority!
Forum Jump: