나는 이것을 wel로 부딪쳤다.
수락 된 답변이 내 요구를 충족시키지 못했습니다. 모든 휴지통의 크기와 전체 휴지통의 크기를 알고 싶었습니다.
WMI 공급자를 사용하면 다음을 쉽게 수행 할 수 있습니다.
(.vbs 파일로 저장)
dim oFS, oFolder, fileSizeTotal
Dim objWMIService, objItem, colItems, colPartitions, objPartition, _
objLogicalDisk, colLogicalDisks
Dim strComputer, strMessage, strPartInfo,strDeviceID,ret
set oFS = WScript.CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject( "WScript.Shell" )
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_DiskDrive")
For Each objItem in colItems
strDeviceID = Replace(objItem.DeviceID, "\", "\\")
Set colPartitions = objWMIService.ExecQuery _
("ASSOCIATORS OF {Win32_DiskDrive.DeviceID=""" & strDeviceID & _
"""} WHERE AssocClass = Win32_DiskDriveToDiskPartition")
For Each objPartition In colPartitions
Set colLogicalDisks = objWMIService.ExecQuery _
("ASSOCIATORS OF {Win32_DiskPartition.DeviceID=""" & _
objPartition.DeviceID & _
"""} WHERE AssocClass = Win32_LogicalDiskToPartition")
strPartInfo = strPartInfo & "Disk Partition: " & objPartition.DeviceID
For Each objLogicalDisk In colLogicalDisks
strPartInfo = strPartInfo & " " & objLogicalDisk.DeviceID
ret = ret & objLogicalDisk.DeviceID & "\"
if oFS.FolderExists(objLogicalDisk.DeviceID&"\$Recycle.Bin") then
RECpath=oShell.ExpandEnvironmentStrings( _
objLogicalDisk.DeviceID & "\$Recycle.Bin")
set oFolder = oFS.GetFolder(RECpath)
ShowFolderDetails(oFolder)
else
ret = ret & " -empty- " & vbCr
end if
Next
strPartInfo = strPartInfo & vbCr
Next
Wscript.Echo ret & "---------" & vbCr & "Total: " & calcSize(fileSizeTotal)
Next
WSCript.Quit
Sub ShowFolderDetails(oF)
Dim size
fileSizeTotal = fileSizeTotal + oF.Size
size = calcSize(oF.Size)
ret = ret & " = " & size & vbCr
end Sub
function calcSize(sizeInB)
Dim fSize, iKB, iMB, iGB, d
iKB = 1024
iMB = iKB * 1024
iGB = iMB * 1024
d = 2
if sizeInB >= iGB then
fSize = round(sizeInB/iGB,d) & " GB"
elseif sizeInB >= iMB then
fSize = round(sizeInB/iMB,d) & " MB"
elseif sizeInB >= iKB then
fSize = round(sizeInB/iKB,d) & " KB"
else
fSize = sizeInB & " B"
end if
calcSize = fSize
end function
또는 여기에서 얻으십시오 : http://dl.dropbox.com/u/32933085/RecycleBinInfo.vbs
편집하다:
파티션에 휴지통이없는 경우 스크립트가 충돌하지 않도록 스크립트를 업데이트했습니다. 또한 바이트가 이제 올바르게 표시됩니다