none
Management of the \$RECYCLE.BIN hidden files of Windows 7 RRS feed

  • Question

  • HI

    Using Powershell for Windows 7:

    1) How do I get the owner of the C:\$RECYCLE.BIN hidden file to then see this owner in a message box?

    2) How do I eliminate, from all the partitions of hard disk, the directory \$RECYCLE.BIN and their contents in order to create these directories completely empty and, as owner, the owner who executed these actions?

    THANKS

    BYE


    Balubeto
    Thursday, August 26, 2010 6:54 PM

Answers

  • **Not tested**

    PS C:\> (get-acl `$recycle.bin).owner
    BUILTIN\Administrators

    PS C:\> $x=(get-acl `$recycle.bin).owner

    PS C:\> $x.SetOwner("New Owner")

    You can likely delete them like this:

    PS C:\> remove-item "C:\`$recycle.bin" -force

    Get the current user:

    ([Security.Principal.WindowsIdentity]::GetCurrent()).Name

    • Marked as answer by Mervyn Zhang Monday, August 30, 2010 10:30 AM
    Friday, August 27, 2010 11:55 AM
    Moderator

All replies

  • **Not tested**

    PS C:\> (get-acl `$recycle.bin).owner
    BUILTIN\Administrators

    PS C:\> $x=(get-acl `$recycle.bin).owner

    PS C:\> $x.SetOwner("New Owner")

    You can likely delete them like this:

    PS C:\> remove-item "C:\`$recycle.bin" -force

    Get the current user:

    ([Security.Principal.WindowsIdentity]::GetCurrent()).Name

    • Marked as answer by Mervyn Zhang Monday, August 30, 2010 10:30 AM
    Friday, August 27, 2010 11:55 AM
    Moderator
  • 1. Open an "elevated command prompt" window. To open this Command prompt, click <start>, click All Programs, click Accessories, right click Command Prompt, and then click Run as Administrator.

    2. Type in the follwoing command and press <enter> rd /s /q C:$Recycle.bin

    3. Type in Exit and press <enter>

    Note: The spaces between rd s q and C are important!

    For any further help refer to The Winhelponline Blog under "How to fix a corrupted recycle bin in Win 7"

    Good luck


    btw, this has been tested and works.
    • Proposed as answer by BadgerROIS Wednesday, June 20, 2012 8:51 PM
    • Unproposed as answer by BadgerROIS Wednesday, June 20, 2012 8:51 PM
    Sunday, August 21, 2011 4:27 AM
  • An even simpler solution (not even related to PowerShell), but tried several times, under both WinXP and Win7 (currently Pro x64); nothing - bad :) - ever happened afterwards:

    Open Total Commander, with hidden files visible (Ctrl+H or enabled in TC options), go to root folder C:\ and delete (Shift+Del) the entire $Recycle Bin folder. It'll come back later, but empty or with a desktop.ini in it (sic!)

    Hope this works for you too!

    Wednesday, June 20, 2012 9:01 PM