On Error Resume Next

Set objShell = CreateObject("WScript.Shell")
objShell.Run "cmd.exe /c echo Y|PowerShell.exe -NoProfile -Command Clear-RecycleBin -Confirm:$false", 0, True

If Err.Number = 0 Then
    MsgBox "資源回收筒已經被清空。"
Else
    MsgBox "無法清空資源回收筒:" & vbCrLf & Err.Description
End If

Set objShell = Nothing

bshadow 發表在 痞客邦 留言(0) 人氣()