Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login

POZE MRRRR'S FORUM (VIEW ONLY)

Nu sunteti logat.
Nou pe simpatie:
ElizaElizaiubi din Satu Mare
Femeie
23 ani
Satu Mare
cauta Barbat
23 - 53 ani
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides / [WINDOWS] Shortcut to Empty the Recycle Bin (LNK or VBS) Moderat de TRaP, TonyTzu
Autor
Mesaj Pagini: 1
Mrrrr
AdMiN

Inregistrat: acum 17 ani
Postari: 2186
I wanted to have an even easier way of emptying the Recycle Bin (easier than right clicking it and selecting Empty Recycle Bin), since I can pin the shortcut to taskbar and just click to empty Recycle Bin.

A. Shortcut file (.LNK)

1. Right click on the Desktop and select New -> Shortcut
2. In the field of the window paste the following line: powershell.exe -windowstyle hidden -command Clear-RecycleBin -Force
3. Click Next then type a name for your shortcut and click Finish
4. Optionally you can edit the icon of your shortcut by right clicking it -> Properties -> Change Icon.... Now either use a personalized icon by pressing Browse and navigate to it, or in the Browse field paste the following line and hit Enter: %SystemRoot%\System32\SHELL32.dll

Source - post by laxmanrawat

Another command line you can use at point 2 with the same result is: powershell.exe -windowstyle hidden Clear-RecycleBin -Force -ErrorAction:Ignore

Both of the codes above flash a window

B. VBS File (downside - Recycle Bin icon doesn't refresh, unless you double click it to enter Recycle Bin)

1. Copy the following code and paste in Notepad, then save as .VBS file.

'#==============================================================================
'#==============================================================================
'#  SCRIPT.........:  emptyRecycleBin.vbs
'#  AUTHOR.........:  Joe Glessner
'#  EMAIL..........:
'#  VERSION........:  1.0
'#  DATE...........:  02OCT09
'#  COPYRIGHT......:  2009, laoae.com
'#  LICENSE........:  Freeware
'#  REQUIREMENTS...: 
'#
'#  DESCRIPTION....:  Empties the Recycle Bin on the local computer.
'#
'#  NOTES..........:  This has only been tested on Windows 7, though it should
'#                    work on all Windows versions, 2000 or later.
'#
'#                    This script will empty the Recycle bin, but will not
'#                    change the icon to show it has been emptied, until the
'#                    recycle bin has been opened by a user.
'#
'#  CUSTOMIZE......: 
'#==============================================================================
'#  REVISED BY.....: 
'#  EMAIL..........: 
'#  REVISION DATE..: 
'#  REVISION NOTES.:
'#
'#==============================================================================
'#==============================================================================
'**Start Encode**

'#==============================================================================
'#  START OF SCRIPT
'#==============================================================================
'Option Explicit
'On Error Resume Next

    '#--------------------------------------------------------------------------
    '#  Declare Constants
    '#--------------------------------------------------------------------------
    Const RECYCLE_BIN = &Ha&
    Const FILE_SIZE = 3
   
    '#--------------------------------------------------------------------------
    '#  Declare Variables
    '#--------------------------------------------------------------------------
    Dim objShell, objFolder, objFSO, colItems
    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.Namespace(RECYCLE_BIN)
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set colItems = objFolder.Items
   
    '#--------------------------------------------------------------------------
    '#  Delete everything in the Recycle Bin
    '#--------------------------------------------------------------------------
    For Each objItem in colItems
        If (objItem.Type = "File folder") Then
            objFSO.DeleteFolder(objItem.Path)

        Else
            objFSO.DeleteFile(objItem.Path)
        End If
    Next

'#==============================================================================
'#  SUBROUTINES/FUNCTIONS/CLASSES
'#==============================================================================

'#==============================================================================
'#  END OF FILE
'#==============================================================================


Source:


_______________________________________


pus acum 2 ani
   
Mrrrr
AdMiN

Inregistrat: acum 17 ani
Postari: 2186
If you want it to show no window, just add the text in color, just like below:

cmd /c start /min "" powershell.exe -WindowStyle hidden -command Clear-RecycleBin -Force -ErrorAction:Ignore


_______________________________________


pus acum 1 an
   
Pagini: 1  

Mergi la