列出回收站中的文件 [英] Listing files in recycle bin
问题描述
我想从命令行列出Vista中回收站中的文件.到目前为止,我有这个:
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.bin\S-1-5-21-931442927-344369455-2477061601-1000\$I2H8K48.zip
C:\$Recycle.bin\S-1-5-21-931442927-344369455-2477061601-1000\$IE94UAG.exe
C:\$Recycle.bin\S-1-5-21-931442927-344369455-2477061601-1000\$IR4P99W.rar
C:\$Recycle.bin\S-1-5-21-931442927-344369455-2477061601-1000\$R2H8K48.zip
C:\$Recycle.bin\S-1-5-21-931442927-344369455-2477061601-1000\$RE94UAG.exe
C:\$Recycle.bin\S-1-5-21-931442927-344369455-2477061601-1000\$RR4P99W.rar
C:\$Recycle.bin\S-1-5-21-931442927-344369455-2477061601-1000\$I2H8K48.zip
C:\$Recycle.bin\S-1-5-21-931442927-344369455-2477061601-1000\$IE94UAG.exe
C:\$Recycle.bin\S-1-5-21-931442927-344369455-2477061601-1000\$IR4P99W.rar
C:\$Recycle.bin\S-1-5-21-931442927-344369455-2477061601-1000\$R2H8K48.zip
C:\$Recycle.bin\S-1-5-21-931442927-344369455-2477061601-1000\$RE94UAG.exe
C:\$Recycle.bin\S-1-5-21-931442927-344369455-2477061601-1000\$RR4P99W.rar
我的回收站中只有3个文件,分别为auto-it-v3-setup.exe
,fcleanerportable.rar
和Reinstall.rar
.
And I only have 3 files in my recycle bin named auto-it-v3-setup.exe
, fcleanerportable.rar
and Reinstall.rar
.
是否有办法将这些名称添加到.txt
文件列表中,而不是上面的那些代号文件?
Is there any way to get these names into a .txt
file list, rather than those code-named files above?
推荐答案
要使用PowerShell按其原始位置列出回收站中的文件(另存为file.ps1,请在|之前删除换行符,以便仅获得两行):
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
这篇关于列出回收站中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!