![]() |
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-11 07:48 |
47,811 topics / 349,897 posts / today 0 new / 48,256 members |
| DOS批处理 & 脚本技术(批处理室) » [Help] Seeking Parameter Explanation: DEL /F /A /Q \\?\%1 and RD /S /Q \\?\%1 |
| Printable Version 3,518 / 9 |
| Floor1 whiteyoo | Posted 2008-11-13 11:03 |
| 新手上路 Posts 11 Credits 16 | |
|
A while ago I saw such a piece of code:
The previous part can be understood, but I don't understand the subsequent \\?\%1. It seems that %1 is the first value input when using this batch processing by default. Everyone, can you give a detailed explanation, what is //? For? Path? Thank you! ───────────────── Moderation Record ───────────────── Performed: HAT Operation: Added search keywords in the post title; added code tags to the code Explanation: The original title " Seeking explanation of parameters in a piece of code" is not conducive to forum search Punishment: Deducted 2 points of points Tip: It is recommended to read the following posts {1415}The Wisdom of Asking Questions {7326}Must-read for forum newcomers, basic code of conduct for everyone {22703}Please don't be an impatient person {32667} Those people who can't even write the title clearly, wake up {32825}This version is strictly rectifying bad posts ───────────────── Moderation Record ───────────────── [ Last edited by HAT on 2008-11-13 at 13:56 ] |
|
| Floor2 5872169 | Posted 2008-11-13 13:21 |
| 高级用户 Posts 474 Credits 959 | |
|
? is any path, any folder
|
|
| Floor3 HAT | Posted 2008-11-13 13:24 |
| 版主 Posts 5,017 Credits 9,023 | |
Q: Why does the command `rd /s /q \\.\h:\autorun.inf\` can delete all folders including the malformed folders? |
|
| Floor4 purplelichen | Posted 2008-11-17 21:58 |
| 新手上路 Posts 8 Credits 8 | |
|
Q: Why is such a command very dangerous?
A: If the folder you want to delete contains special paths, it may cause the entire data of the disk partition to be deleted. Therefore, if you are not fully familiar with this command, it is not recommended to use such a command. ---------------------------- I want to emphasize the above sentence, take an example: Suppose the h: drive is a USB flash drive partition, and there is a "Delete Stubborn Files.bat" below, the code is: rem --------------------------------------------- DEL /F /A /Q \\?\%1 RD /S /Q \\?\%1 rem --------------------------------------------- At the same time, there is a text file named &1.txt under the h: drive. At this time You want to use "Delete Stubborn Files.bat" to delete &1.txt. When you drag &1.txt to On "Delete Stubborn Files.bat", you find that all files and folders under the h: drive are all Was deleted. This is because the passed parameter contains the special character "&" (such special characters also include "^"), Those who are interested in this problem or have solutions can go to this topic in this section: Regarding the problem of batch processing replaceable parameters |
|
| Floor5 radem | Posted 2008-11-19 12:17 |
| 高级用户 Posts 383 Credits 691 | |
|
It's really very dangerous. Everyone should use such commands with caution.
|
|
| Floor6 ZJHJ | Posted 2008-11-20 22:05 |
| 高级用户 Posts 374 Credits 609 | |
Originally posted by purplelichen at 2008-11-17 21:58: After my experiment, it's not that the ones with ^ characters and & characters are dangerous, but those with ^& combined characters are definitely dangerous. However, the following code will not be dangerous: [ Last edited by ZJHJ on 2008-11-20 at 22:10 ] |
|
| Floor7 menghen | Posted 2009-01-27 00:00 |
| 新手上路 Posts 6 Credits 10 | |
| Floor8 samliu | Posted 2009-02-05 22:14 |
| 新手上路 Posts 15 Credits 15 | |
|
Learned. Fortunately, I haven't tried it on the USB drive. Otherwise, it would really be dangerous. Thanks, the landlord's reminder
|
|
| Floor9 everest79 | Posted 2009-02-06 17:20 |
| 金牌会员 Posts 1,127 Credits 2,564 | |
|
This is not a danger caused by this UNC identifier, but an error caused by the batch processing itself. You pass H:\&1.txt in the batch processing, then what is executed is
rd /s /q \\?\H:\ 1.txt del /f /a /q \\?\H:\ 1.txt & is a special connection command in cmd. The result of you executing rd /s /q H:\&1.txt is also the same |
|
| Floor10 zhengqian529 | Posted 2009-02-06 19:24 |
| 初级用户 Posts 93 Credits 100 From 湖南 | |
|
Got it, learned something. Why has the standard not restricted the inclusion of the '&' character in file names all along, but only restricted '/ \ : * ? " < > |'?
|
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |