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:\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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM