strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
dtmYesterday = Date - 90
strYear = Year(dtmYesterday)
strMonth = Month(dtmYesterday)
If Len(strMonth) = 1 Then
strMonth = "0" & strMonth
End If
strDay = Day(dtmYesterday)
If Len(strDay) = 1 Then
strDay = "0" & strDay
End If
strDate = strYear & strMonth & strDay &"000000.000000+000"
wscript.echo(strDate) //貌似只會執行到此,雙擊后會顯示三個月前的日期. Set colFiles = objWMIService.ExecQuery("SELECT * FROM CIM_DataFile WHERE Path = '\\MDaemon\\users\\gwspam.com\\bak\\7daysago.IMAP\\' AND Drive = 'd:' AND Extension = 'msg' AND CreationDate < '" & strDate & "'")
For Each objFile In colFiles
objFile.Delete()
Next
wscript.echo("success delete 100 DAYS ago mails!")作者: steven_zgf 时间: 2009-10-12 08:20
沒人幫頂嗎?作者: steven_zgf 时间: 2009-10-12 11:29
版主幫忙呀!