Listing files in recycle bin

后端 未结 2 1594
北海茫月
北海茫月 2020-12-15 13:30

I want to list the files that are in the recycle bin in Vista from the command line. So far I have this:

dir C:\\$Recycle.Bin /s /b >> recyclebin.txt
<         


        
2条回答
  •  时光取名叫无心
    2020-12-15 13:57

    To list files in Recycle Bin by their original location using PowerShell (save as file.ps1, remove line breaks before | so that you get only two lines):

    (New-Object -ComObject Shell.Application).NameSpace(0x0a).Items()
    |select @{n="OriginalLocation";e={$_.ExtendedProperty("{9B174B33-40FF-11D2-A27E-00C04FC30871} 2")}},Name
    | export-csv -delimiter "\" -path C:\Users\UserName\Desktop\recycleBinFiles.txt -NoTypeInformation
    
    (gc C:\Users\UserName\Desktop\recycleBinFiles.txt | select -Skip 1)
    | % {$_.Replace('"','')}
    | set-content C:\Users\UserName\Desktop\recycleBinFiles.txt
    

提交回复
热议问题