I want a WPF button that will open explorer.exe on Windows 7 | 8 straight to the "basket". This is because my application erases many files, and I want to provide the user with a quick way to recover files. Command line arguments do not work, possibly because the Recycle Bin is a virtual directory. I tried using the "$ Recycle Bin". Explorer.exe / root, where a is a virtual file. Trying to protect space in Recycle \ Bin does not work either.
Here is the working code of Scott Powell that I tested and use. Thanks Scott @
private void ExploreTrashBin ( ) { String str_RecycleBinDir = String.Format(@"C:\$Recycle.Bin\{0}", UserPrincipal.Current.Sid); Process . Start ( "explorer.exe" , str_RecycleBinDir ); } private void TrashBin_Button_Click ( object sender , RoutedEventArgs e ) { ExploreTrashBin ( ); }
source share