Board logo

标题: [文件操作] wmic条件筛选运算符的选择 [打印本页]

作者: zhouyongjun    时间: 2009-6-22 22:41     标题: wmic条件筛选运算符的选择

最近学习WMIC,有很多疑惑,下面问题请大家帮下忙:
一:
  1. C:\Documents and Settings\Administrator>wmic datafile where "drive='e:' and path
  2. ='\\批处理-VBS\\test\\' and filesize='14'" get name,filesize
  3. FileSize  Name
  4. 14        e:\批处理-vbs\test\test.bat
复制代码

二:
  1. C:\Documents and Settings\Administrator>wmic datafile where "drive='e:' and path
  2. ='\\批处理-VBS\\test\\' and filesize>'14'" get name,filesize
  3. 无可用范例。
复制代码

三:
  1. C:\Documents and Settings\Administrator>wmic datafile where "drive='e:' and path
  2. ='\\批处理-VBS\\test\\' and extension='txt' and filesize>'14'" get name,filesize
  3. FileSize  Name
  4. 23        e:\批处理-vbs\test\b.txt
  5. 745747    e:\批处理-vbs\test\xiake.txt
复制代码

1.请问下二中变为大于号就得不到结果了,而三种给它指定了扩展名就又能得到结果,这是什么原因?能不能帮解释下,我甚是疑惑。
2.可不可以修改下,只要filesize>14这个条件,显示满足条件所有格式的文件(不要P,想学习下WMIC)
作者: zhouyongjun    时间: 2009-6-26 14:07

我的帖子沉到这下面了,没人回答
顶上来先!!!
作者: zqz0012005    时间: 2009-6-26 15:54

这可能是wmic不完善的地方之一。在脚本中没有问题。
  1. set colFiles=getobject("winmgmts:").execquery _
  2.     ("select * from cim_datafile where drive='c:' and path='\\' and filesize>1")
  3. for each objFile in colFiles
  4.     wsh.echo objFile.name
  5. next
复制代码





欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2