码迷,mamicode.com
首页 > 其他好文 > 详细

wmic 操作文件的datafile

时间:2020-11-07 15:59:22      阅读:24      评论:0      收藏:0      [点我收藏+]

标签:txt   目录   name   filename   wmi   computer   cmd文件   ssm   lld   

wmic datafile /?
动词有ASSOC,CALL,CREATE,DELETE,GET,LIST 这几个

命令:
wmic datafile where "filename=‘dsc04059‘ and extension=‘jpg‘ and drive=‘f:‘" list /format:value

结果:
AccessMask=18809343
Archive=TRUE
Caption=f:\dsc04059.jpg
Compressed=FALSE
CompressionMethod=
CreationClassName=CIM_LogicalFile
CreationDate=20091012174149.578125+480
CSCreationClassName=Win32_ComputerSystem
CSName=20090621-1240
Description=f:\dsc04059.jpg
Drive=f:
EightDotThreeFileName=f:\dsc04059.jpg
Encrypted=FALSE
EncryptionMethod=
Extension=jpg
FileName=dsc04059
FileSize=86092
FileType=Kankan JPEG 图像
FSCreationClassName=Win32_FileSystem
FSName=NTFS
Hidden=FALSE
InstallDate=20091012174149.578125+480
InUseCount=
LastAccessed=20100412155336.781250+480
LastModified=20091009140702.000000+480
Manufacturer=
Name=f:\dsc04059.jpg
Path=\
Readable=TRUE
Status=OK
System=FALSE
Version=
Writeable=TRUE


实例:
DATAFILE – DataFile 管理
::查找e盘下test目录(不包括子目录)下的cc.cmd文件
wmic datafile where “drive=’e:’ and path=’\\test\\’ and FileName=’cc’ and Extension=’cmd’” list
::查找e盘下所有目录和子目录下的cc.cmd文件,且文件大小大于1K
wmic datafile where “drive=’e:’ and FileName=’cc’ and Extension=’cmd’ and FileSize>’1000′” list
::删除e盘下文件大小大于10M的.cmd文件
wmic datafile where “drive=’e:’ and Extension=’cmd’ and FileSize>’10000000′” call delete
::删除e盘下test目录(不包括子目录)下的非.cmd文件
wmic datafile where “drive=’e:’ and Extension<>’cmd’ and path=’test’” call delete
::复制e盘下test目录(不包括子目录)下的cc.cmd文件到e:\,并改名为aa.bat
wmic datafile where “drive=’e:’ and path=’\\test\\’ and FileName=’cc’ and Extension=’cmd’” call copy “e:\aa.bat”
::改名c:\hello.txt为c:\test.txt
wmic datafile “c:\\hello.txt” call rename c:\test.txt
::查找h盘下目录含有test,文件名含有perl,后缀为txt的文件
wmic datafile where “drive=’h:’ and extension=’txt’ and path like ‘%\\test\\%’ and filename like ‘%perl%’” get name

wmic 操作文件的datafile

标签:txt   目录   name   filename   wmi   computer   cmd文件   ssm   lld   

原文地址:https://www.cnblogs.com/hyyx/p/13935965.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!