page307.vbs
来自「Apress - Managing Enterprise Systems Wit」· VBS 代码 · 共 19 行
VBS
19 行
Dim objService, objWMIFiles, nResult, objFile
'get a reference to a WMI service
Set objService = GetObject("winmgmts:{impersonationLevel=impersonate}")
'get all files with .tmp extenstion on the C: drive
Set objWMIFiles = _
objService.ExecQuery ("Select Name From CIM_DataFILE Where " & _
"Drive='C:' And Extension='tmp'")
'loop through all files and attempt to delete them
For Each objFile In objWMIFiles
nResult = objFile.Delete
If nResult <> 0 Then
WScript.Echo "*Unable to delete " & objFile.Name
Else
WScript.Echo "Successfully deleted file:" & objFile.Name
End If
Next
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?