wmic 操作文件的datafile

Posted hyyx

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了wmic 操作文件的datafile相关的知识,希望对你有一定的参考价值。

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: est.txt
wmic datafile “c:\hello.txt” call rename c: est.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的主要内容,如果未能解决你的问题,请参考以下文章

表空间及用户操作

oracle数据库维护操作

C++ 文件读写

Linux编译WMIC

如何在 Windows PE 脚本中使用 `wmic`?

Oracle数据库的操作流程