Const CLSID = "::{645FF040-5081-101B-9F08-00AA002F954E}" Set oShell = CreateObject("Shell.Application") Set oRecycleBin = oShell.Namespace(0).ParseName(CLSID) oRecycleBin.InvokeVerb "Empty Recycle &Bin"

const ssfBITBUCKET = 10 Set objFso = CreateObject("Scripting.FileSystemObject") Set objShell = CreateObject("Shell.Application") Set objBitBucket = objShell.Namespace(ssfBITBUCKET) Set colDeleted = objBitBucket.Items() For Each objDeleted In colDeleted If objDeleted.Type = "File Folder" Then objFso.DeleteFolder(objDeleted.Path) Else objFso.DeleteFile(objDeleted.Path) End If Next

DriveLetter:\RECYCLER\User Account SID\

Const strRecycler = "\\RECYCLER\\" Set objSWbemServices = GetObject _ ("WinMgmts:Root\Cimv2") Set colUsers = objSWbemServices.ExecQuery _ ("Select * From Win32_UserAccount") For Each objUser In colUsers Set colDisks = objSWbemServices.ExecQuery _ ("Select * From Win32_LogicalDisk " & _ "Where DriveType = 3") For Each objDisk In colDisks Set colDeletedFiles = objSWbemServices.ExecQuery _ ("Select * From Cim_DataFile Where Drive = '" _ & objDisk.DeviceId _ & "' And Path = '" & strRecycler & objUser.Sid & "\\' " _ & "And Hidden = False") For Each objDeletedFile In colDeletedFiles WScript.Echo objDeletedFile.Name 'objDeletedFile.Delete Next Set colDeletedFolders = objSWbemServices.ExecQuery _ ("Select * From Win32_Directory Where Drive = '" _ & objDisk.DeviceId _ & "' And Path = '" & strRecycler & objUser.Sid & "\\' " _ & "And Hidden = False") For Each objDeletedFolder In colDeletedFolders WScript.Echo objDeletedFolder.Name 'objDeletedFolder.Delete Next Next Next

If you search the VBScript newsgroup archive you can find a script that looks like this:It uses Shell.Application object to empty recycle bin for the current user. Depending on the user settings, it is possible that the confirmation dialoq will be shown asking the user to confirm file deletion. It also displays a progress popup window. Also, depending on user regional settings, it is possible that the verb to empty recycle bin will not be named 'Empty Recycle Bin'.Another way to do this is to use Shell.Application to get the path for each deleted file or folder, and then use FSO to delete them:This script will not show any dialogs, but when the files are deleted, the Recycle Bin icon on the desktop will not change to empty, and the script also works only for the current user.On my computer (Windows XP SP 3) Recycle Bin folder paths look like this:You could try to use this to delete the files in each user's Recycle Bin. You would first need to enumerate the users (using the Win32_UserAccount WMI class) and use their SIDs to construct path to each user's Recycle Bin folder. Then you would use Cim_DataFile to enumerate the files in each Recycle Bin folder and delete them. This is what the script could look like:I haven't used this kind of script before, and I don't know of any issues you might find, so if you decide to go this way make sure you do enough testing. I also don't know if it will work on Windows versions other than XP SP3.Uros Calakovic