我在尋找被刪除的文件exe文件下面具體尺寸只是在驅動器C:/,但沒有被刪除的文件的文件夾,筆者在驅動器C:/刪除的文件exe文件下面具體尺寸在驅動器C:/
我有代碼在所有驅動器d vbsript工作:/ E:/ F:/只在C:/是不行的,因爲C:系統/驅動器,我覺得
'Here we set your global variables. These values
'don't change during the runtime of your script.
Set oFSO = CreateObject("Scripting.FileSystemObject")
sDirectoryPath = "c:\"
RecurseFolders sDirectoryPath
Sub RecurseFolders(sFolder)
'Here we set the oFolder object, note that it's
'variable scope is within this sub, so you can
'set it many times and it's value will only be
'that of the sub that's currently running.
Set oFolder = oFSO.GetFolder(sFolder)
'Here we are looping through every file in the
'directory path.
For Each oFile In oFolder.Files
'This just checks for a file size less than 450Kb
If oFile.Size < 450000 And Right(LCase(oFile.Name),3) = "exe" Then
oFile.Delete True
End If
Next
End Sub
'When calling subs you don't need to set their value
'to a variable name, and you don't use parenthesis.
'Clean up
Set oFSO = Nothing
試運行具有管理員權限的腳本(右鍵單擊並以「以管理員身份運行」) –
「以管理員身份運行」這是僅適用於應用程序 –