|
honyfox
初级用户
 
积分 26
发帖 11
注册 2006-12-16
状态 离线
|
『楼 主』:
[求助]for命令修改所有隐藏文件属性
使用 LLM 解释/回答一下
原本打算用for命令来删除磁盘上所有的*.info文件,用的批处理命令是
for /r %%a in (c: d: e: f:) do tree /f > 1.txt
for %%a in (1.txt) do del *.info
但是*.info文件却被自动加了隐藏属性,不知道这个该怎么处理,请教大家了,多谢!
我开始用的是for /r %%a in (c: d: e: f:) do attrib -h *.info,但是运行发现只是在对当前目录的info文件作修改,如果改成for /r %%a in (c: d: e: f:) do attrib -h *.info %%a,就会提示参数错误。刚学批处理,对命令理解不够,请大家不吝赐教,再次致谢!
Last edited by honyfox on 2007-1-18 at 08:16 PM ]
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 ]
|
|
2007-1-19 09:09 |
|
|
oilio
高级用户
    前进者
积分 641
发帖 303
注册 2007-1-10
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
楼主指的所有隐藏文件,说得好像很含糊啊,到底是硬盘上所有的隐藏文件你都想去掉它的属性,还是指把一个分区里的所有隐藏文件的属性去掉?还是别的??
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?
|

我相信总有一天,总会遇到一个人可以相濡以沫、相吻以湿! |
|
2007-1-19 09:12 |
|
|
honyfox
初级用户
 
积分 26
发帖 11
注册 2006-12-16
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
不好意思,刚才编辑的时候不小心按到Ctrl+Enter给发了,还没写完,Sorry
Sorry, I accidentally pressed Ctrl+Enter to send it while editing just now, and it wasn't finished yet. Sorry
|
|
2007-1-19 09:16 |
|
|
lxmxn
版主
       
积分 11386
发帖 4938
注册 2006-7-23
状态 离线
|
   『第 4 楼』:
使用 LLM 解释/回答一下
如果是Windows XP的系统,在命令行试试下面这个命令?
for /f "skip=1" %i in ('wmic logicaldisk where "drivetype='3'" get caption') do @ del /s/a/f/q %i\*.info
If it's a Windows XP system, try the following command in the command line?
for /f "skip=1" %i in ('wmic logicaldisk where "drivetype='3'" get caption') do @ del /s/a/f/q %i\*.info
此帖被 +4 点积分 点击查看详情 评分人:【 htysm 】 | 分数: +4 | 时间:2007-1-20 03:24 |
|
|
|
2007-1-19 09:34 |
|
|
honyfox
初级用户
 
积分 26
发帖 11
注册 2006-12-16
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
成功了,lxmxn真厉害!
第一次接触到wmic这个命令,刚去查了查,今天又有不小收获了,谢谢lxmxn了!
另外skip这里的用法我不懂,请教一下,谢谢!
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!
|
|
2007-1-19 09:50 |
|
|
lxmxn
版主
       
积分 11386
发帖 4938
注册 2006-7-23
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
因为在for命令里面 ,skip=n代表忽略前n行,而这里wmic命令的输出的第一行是"Caption",如下图所示,所以这里用"skip=1"跳过第一行提取驱动器盘符。
Caption
C:
D:
E:
F:
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.
Caption
C:
D:
E:
F:
|
|
2007-1-19 09:57 |
|
|
honyfox
初级用户
 
积分 26
发帖 11
注册 2006-12-16
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
哦,懂了,谢谢lxmxn了 ^_^
Oh, got it, thank you lxmxn ^_^
|
|
2007-1-19 10:08 |
|
|
oilio
高级用户
    前进者
积分 641
发帖 303
注册 2007-1-10
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
强啊,这个命令我也很少看见,还有一次也是看见lxmxn发的,是得知计算机上一共有几个分区的。
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.
|

我相信总有一天,总会遇到一个人可以相濡以沫、相吻以湿! |
|
2007-1-20 01:30 |
|
|
htysm
高级用户
   
积分 866
发帖 415
注册 2005-12-4
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
DOS论坛真乃“牛人如云”啊。这么一行命令就能遍历电脑中的所有驱动器中的所有文件。
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.
|
|
2007-1-20 03:17 |
|
|
oilio
高级用户
    前进者
积分 641
发帖 303
注册 2007-1-10
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
lxmxn能不能给我霁一下'wmic logicaldisk where "drivetype='3'" get caption'这段命令的含义。只知道logicaldisk好像是说逻辑磁盘,后面的就不知道了。这个命令是属于什么命令啊,很早前学过一点点dos的基础,好像没有碰过这个命令啊。。看了一下帮助里的,有些不大懂。
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.
|

我相信总有一天,总会遇到一个人可以相濡以沫、相吻以湿! |
|
2007-1-20 09:39 |
|
|
lxmxn
版主
       
积分 11386
发帖 4938
注册 2006-7-23
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
Re oilio:
这里的'wmic logicaldisk where "drivetype='3'" get caption'命令是获取磁盘驱动器盘符的,其中where相当于一个筛选,drivetype=3指定要筛选的驱动器类型代号为3的驱动器。当然,还有其它的类型,比如2代表软盘驱动器,3代表磁盘驱动器,5代表光盘驱动器(CD-ROM)。这里指定了是3,那么命令给出的,就是所有硬盘驱动器的盘符了;
这里的get是一个动词,在WMIC里面,代表了获取一个别名的属性,caption就是logicaldisk别名的一个属性,其属性值正是驱动器的盘符;
Logicaldisk还有其它的很多属性,比如DeviceID,DriveType,FreeSpace,ProviderName,Size,VolumeName等属性,可以用get动词来获取,具体的命令帮助就可以输入命令wmic logicaldisk get /?得到。
建议你搜索一下前任版主3724668版主关于WMIC命令的使用,我也是刚学,不是很懂,有错误的地方,兄见谅了。
Last edited by lxmxn on 2007-1-19 at 10:24 PM ]
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 ]
此帖被 +2 点积分 点击查看详情 评分人:【 oilio 】 | 分数: +2 | 时间:2007-1-21 03:48 |
|
|
|
2007-1-20 11:15 |
|
|
tracert
新手上路

积分 8
发帖 4
注册 2007-1-10
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
lxmxn你太厉害了
那个命令太有用了
lxmxn you are so great
that command is so useful
|
|
2007-1-21 00:05 |
|
|
oilio
高级用户
    前进者
积分 641
发帖 303
注册 2007-1-10
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
嗯,好的,谢谢lxmln兄,我去学习学习。感觉这个命令挺有用的。受教了。
Well, okay, thank you, Brother lxmln. I'll go study it. It feels like this command is quite useful. Learned something.
|

我相信总有一天,总会遇到一个人可以相濡以沫、相吻以湿! |
|
2007-1-21 03:50 |
|
|
lovesaly
新手上路

积分 12
发帖 6
注册 2006-12-18
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
厉害啊
我还没有见过这个命令呢
又学到了一点东西咯
That's amazing! I haven't seen this command before. I've learned something new again.
|
|
2007-1-21 05:46 |
|
|
bob1989
中级用户
  
积分 322
发帖 144
注册 2007-1-10
状态 离线
|
『第 15 楼』:
使用 LLM 解释/回答一下
C:\>wmic
'wmic' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
C:\>wmic
'wmic' is not recognized as an internal or external command,
operable program or batch file.
|
|
2007-1-22 10:02 |
|