Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

This works alright, the output I get is this:

C:$Recycle.binS-1-5-21-931442927-344369455-2477061601-1000$I2H8K48.zip C:$Recycle.binS-1-5-21-931442927-344369455-2477061601-1000$IE94UAG.exe C:$Recycle.binS-1-5-21-931442927-344369455-2477061601-1000$IR4P99W.rar C:$Recycle.binS-1-5-21-931442927-344369455-2477061601-1000$R2H8K48.zip C:$Recycle.binS-1-5-21-931442927-344369455-2477061601-1000$RE94UAG.exe C:$Recycle.binS-1-5-21-931442927-344369455-2477061601-1000$RR4P99W.rar

And I only have 3 files in my recycle bin named auto-it-v3-setup.exe, fcleanerportable.rar and Reinstall.rar.

Is there any way to get these names into a .txt file list, rather than those code-named files above?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
621 views
Welcome To Ask or Share your Answers For Others

1 Answer

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:UsersUserNameDesktop
ecycleBinFiles.txt -NoTypeInformation

(gc C:UsersUserNameDesktop
ecycleBinFiles.txt | select -Skip 1)
| % {$_.Replace('"','')}
| set-content C:UsersUserNameDesktop
ecycleBinFiles.txt

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...