![]() |
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-09-15 13:52 |
47,812 topics / 349,917 posts / today 0 new / 48,268 members |
| DOS批处理 & 脚本技术(批处理室) » [Help]Modify attributes of all hidden files with for command |
| Printable Version 6,565 / 32 |
| Floor1 honyfox | Posted 2007-01-19 09:09 |
| 初级用户 Posts 11 Credits 26 | |
|
Originally, I planned to use the for command to delete all *.info files on the disk. The batch commands used were:
for /r %%a in (c: d: e: f:) do tree /f > 1.txt for %%a in (1.txt) do del *.info But the *.info files were automatically given the hidden attribute. I don't know how to handle this. I'm asking everyone for help. Thanks! I initially used for /r %%a in (c: d: e: f:) do attrib -h *.info, but when I ran it, I found that it only modified the info files in the current directory. If I changed it to for /r %%a in (c: d: e: f:) do attrib -h *.info %%a, it would prompt a parameter error. I'm just learning batch processing and don't understand the commands well. Please give me your advice. Thanks again! [ Last edited by honyfox on 2007-1-18 at 08:16 PM ] |
|
| Floor2 oilio | Posted 2007-01-19 09:12 |
| 高级用户 Posts 303 Credits 641 | |
|
The landlord refers to all hidden files, which is said to be very vague. Do you mean you want to remove the attributes of all hidden files on the hard disk, or do you mean to remove the attributes of all hidden files in a partition? Or something else?
|
|
| Floor3 honyfox | Posted 2007-01-19 09:16 |
| 初级用户 Posts 11 Credits 26 | |
|
Sorry, I accidentally pressed Ctrl+Enter to send it while editing just now, and it wasn't finished yet. Sorry
|
|
| Floor4 lxmxn | Posted 2007-01-19 09:34 |
| 版主 Posts 4,938 Credits 11,386 | |
|
If it's a Windows XP system, try the following command in the command line?
|
|
| Floor5 honyfox | Posted 2007-01-19 09:50 |
| 初级用户 Posts 11 Credits 26 | |
|
It worked, lxmxn is really amazing!
First time I came across the wmic command, just looked it up today and got a good gain again, thanks to lxmxn! Also, I don't understand the usage of skip here, ask for advice, thanks! |
|
| Floor6 lxmxn | Posted 2007-01-19 09:57 |
| 版主 Posts 4,938 Credits 11,386 | |
|
Because in the for command, skip=n means to ignore the first n lines. And the first line of the output of the wmic command here is "Caption", as shown in the following figure, so here we use "skip=1" to skip the first line and extract the drive letter.
|
|
| Floor7 honyfox | Posted 2007-01-19 10:08 |
| 初级用户 Posts 11 Credits 26 | |
|
Oh, got it, thank you lxmxn ^_^
|
|
| Floor8 oilio | Posted 2007-01-20 01:30 |
| 高级用户 Posts 303 Credits 641 | |
|
Powerful! I rarely see this command too. There was also once when I saw lxmxn post it, which was to find out how many partitions there are on the computer.
|
|
| Floor9 htysm | Posted 2007-01-20 03:17 |
| 高级用户 Posts 415 Credits 866 | |
|
The DOS forum is really "full of great people"! With just this one line of command, you can traverse all files in all drives on the computer.
|
|
| Floor10 oilio | Posted 2007-01-20 09:39 |
| 高级用户 Posts 303 Credits 641 | |
|
lxmxn Can you explain the meaning of 'wmic logicaldisk where "drivetype='3'" get caption' for me? I only know that logicaldisk seems to mean logical disk, and I don't know the rest. What kind of command is this? I learned a little bit of DOS basics a long time ago, and I don't seem to have come across this command. I looked at the help, but some things are not very understandable.
|
|
| Floor11 lxmxn | Posted 2007-01-20 11:15 |
| 版主 Posts 4,938 Credits 11,386 | |
|
Re oilio:
The command 'wmic logicaldisk where "drivetype='3'" get caption' here is used to obtain the drive letters of disk drives. Here, where acts as a filter, and drivetype=3 specifies to filter drive types with the code 3. Of course, there are other types, such as 2 for floppy disk drives, 3 for disk drives, and 5 for CD-ROM drives. Since 3 is specified here, the command will give the drive letters of all hard disk drives; Here, get is a verb. In WMIC, it represents obtaining the property of an alias. Caption is a property of the logicaldisk alias, and its property value is exactly the drive letter of the drive; Logicaldisk has many other properties, such as DeviceID, DriveType, FreeSpace, ProviderName, Size, VolumeName, etc. These properties can be obtained using the get verb. The specific command help can be obtained by entering the command wmic logicaldisk get /?. It is recommended that you search for the previous moderator version 3724668's usage of WMIC commands. I am also just learning and don't understand very well. Please forgive any errors, brother. [ Last edited by lxmxn on 2007-1-19 at 10:24 PM ] |
|
| Floor12 tracert | Posted 2007-01-21 00:05 |
| 新手上路 Posts 4 Credits 8 | |
|
lxmxn you are so great
that command is so useful |
|
| Floor13 oilio | Posted 2007-01-21 03:50 |
| 高级用户 Posts 303 Credits 641 | |
|
Well, okay, thank you, Brother lxmln. I'll go study it. It feels like this command is quite useful. Learned something.
|
|
| Floor14 lovesaly | Posted 2007-01-21 05:46 |
| 新手上路 Posts 6 Credits 12 | |
|
That's amazing! I haven't seen this command before. I've learned something new again.
|
|
| Floor15 bob1989 | Posted 2007-01-22 10:02 |
| 中级用户 Posts 144 Credits 322 | |
|
C:\>wmic
'wmic' is not recognized as an internal or external command, operable program or batch file. |
|
| 1 2 3 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |