中国DOS联盟论坛

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-08-12 08:17
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » How to use DOS commands to force delete certain files that cannot be deleted?
Printable Version  4,815 / 15
Floor1 ggyy66 Posted 2008-05-27 08:34
初级用户 Posts 69 Credits 173
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?
Floor2 bat-zw Posted 2008-05-27 09:00
金牌会员 Posts 1,276 Credits 3,105
attrib -h -s -a a.bvf
del /s /q /f a.bvf
Floor3 HAT Posted 2008-05-27 09:06
版主 Posts 5,017 Credits 9,023
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
Floor4 ggyy66 Posted 2008-05-27 09:23
初级用户 Posts 69 Credits 173
Replacement isn't always usable. MP3 wasn't tried. But EXE files can't be replaced.
Floor5 ggyy66 Posted 2008-05-27 09:25
初级用户 Posts 69 Credits 173
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.
Floor6 zqz0012005 Posted 2008-05-27 11:02
中级用户 Posts 135 Credits 297
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...
Floor7 slore Posted 2008-05-27 11:56
铂金会员 Posts 2,478 Credits 5,212
Does unlocker have parameters...

ren to old
Delete after restart...
Floor8 ggyy66 Posted 2008-05-27 16:51
初级用户 Posts 69 Credits 173
I just want to use DOS commands to achieve the function of unlocker, remove the lock, and then delete it.
Floor9 jiulong Posted 2008-05-29 17:26
中级用户 Posts 183 Credits 396
rd /s/q \\?\%1
del /f/a/q \\?\%1

Drag any unremovable files onto this batch icon
Floor10 plp626 Posted 2008-05-29 17:41
银牌会员 Posts 1,020 Credits 2,278
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.
Floor11 ggyy66 Posted 2008-06-01 01:11
初级用户 Posts 69 Credits 173
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?
Floor12 jh1688 Posted 2008-06-09 06:01
中级用户 Posts 126 Credits 248
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.
Floor13 tanyi Posted 2010-11-07 23:38
新手上路 Posts 4 Credits 7 From 湖南
You can try the rm command
Floor14 xswdong Posted 2010-11-11 03:36
中级用户 Posts 129 Credits 216
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
Floor15 naiveboy520 Posted 2010-11-12 22:07
初级用户 Posts 37 Credits 40
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!
1 2  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023