22

I've created a substed drive on Windows 7. When I delete a file, it doesn't go to the recycle bin, instead it is deleted permanently.

Recycle bin properties do not show this drive at all.

Any hack to send the files from substed drives to the recycle bin?

8 Answers8

14
  1. Browse to C:\users\.
  2. Right-click on one of the folders in this location (I chose saved games) and click properties.
  3. Select the Location tab.
  4. Click Move, browse to to root of the mapped drive, and click Select Folder.
  5. When asked "move all content?" it's your decision, I prefer "No".

A $RECYCLE.BIN is created in the mapped drive and the drive is in the list shown in the properties of recyclebin.

If you move the location back to C:\users..., the mapped drive is removed from the list of drives that are covered by recycle bin. But the Recyclebin itself remains in the mapped drive. Allowing you to access deleted files from other drives, only.

Source: Microsoft

4

There is an approach that does not require you to redirect one of the "Users" folders. I don't know why, but I was unable to get that approach to work, and I found it was really messy to undo.

This REG file is based on the information compiled from this TechNet article, which discusses how to enable the Recycle Bin. The example maps the virutal Q drive to folder "OneDrive - Test", and enables the Recycle Bin on the Q drive. Change the paths and name to suit your situation.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices]
"Q:"="\\??\\C:\\Users\\Tony\\OneDrive - Test"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{9147E464-33A6-48E2-A3C9-361EFD417DEF}]
"RelativePath"="Q:\\"
"Category"=dword:00000004
"Name"="Q_Mapped_OneDrive"

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\BitBucket\KnownFolder\{9147E464-33A6-48E2-A3C9-361EFD417DEF}]
"MaxCapacity"=dword:0000c7eb
"NukeOnDelete"=dword:00000000

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{9147E464-33A6-48E2-A3C9-361EFD417DEF}]
"RelativePath"="Q:\\"
"Category"=dword:00000004
"Name"="Q_Mapped_OneDrive"

[HKEY_CURRENT_USER\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\BitBucket\KnownFolder\{9147E464-33A6-48E2-A3C9-361EFD417DEF}]
"MaxCapacity"=dword:0000c7eb
"NukeOnDelete"=dword:00000000

If you only have one such mapped drive, then you can get away with the GUID {9147E464-33A6-48E2-A3C9-361EFD417DEF}. If you have multiple mapped drives, then each should be matched to its own GUID from your favorite GUID generator.

3

According to various sources, the recycle bin indeed seems to not be available for that kind of drive.

Riduidel
  • 1,565
2

I faced the same issue and since I did not find any (for me) suitable solution, I began playing and trying around a little... I copied the $Recycle.bin folder from one drive to my substed drive and this seems to be an easy and working solution.

Don
  • 29
1

A Tricky way, use explorer shortcut folder to map target virtual drive:

pic1 pic2

It works in my windows 10, I choose "3D object" to map.

VictorV
  • 119
0

I create SUBST drives like this: SUBST S: C:\DRIVES\DRIVE-S If you want to delete files in SUBST drives, but want the peace of mind that you can undelete it if needed, instead of deleting the file from the virtual drive, example: Drive "S", delete it from the actual folder, example: C:\DRIVES\DRIVE-S. It will go to the Recycle bin.

If you like to put shortcut icons for your virtual drives on the desktop, don't make the shortcut of the virtual drive letter, make it of the actual folder like above: C:\DRIVES\DRIVE-S. You can right-click on the shortcut folder icon, select: PROPERTIES, then select: CHANGE ICON, and choose an icon that looks like a drive or whatever you want. That way if you delete a file using the shortcut, the file will go to the recycle bin.

Gamer
  • 1
0

Windows Specifications Used for Testing

  • Edition: Windows 10 Pro
  • Version: 22H2
  • OS build: 19045.2965
Note
The commands below were tested by running in Windows PowerShell as an Administrator.
Changes to the registry may require a restart before taking effect.

Create Substituted Drive for All Users

Below is an example for creating a drive X: from the already existing folder C:\Games And Software.

reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices" /v X: /t REG_SZ /d "\??\C:\Games And Software"

Removing Substituted Drive for All Users

Below is an example undoing the change made by the previous section.

reg delete "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices" /v X: /f

Enabling Recycle Bin for a Substituted Drive

Below is an example where the recycle bin is enabled for the substituted drive X:. This involves creating a new GUID (stored in the variable $guid). This GUID is then used to create the required key (stored in the variable $key).

$guid=$("{"+[guid]::NewGUID().ToString().ToUpper()+"}")
$key="HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\$guid"
reg add "$key" /v RelativePath /t REG_SZ /d X:\
reg add "$key" /v Name /t REG_SZ /d DriveX
reg add "$key" /v Category /t REG_DWORD /d 4

Disabling Recycle Bin for a Substituted Drive

Below is an example undoing the changes made by the previous section. The command below searches for the key.

reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions /s /c /e /d /f DriveX

Below is example output from the above command.


HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{49476EF1-1FF2-4735-8D84-9453D4B90341}
    Name    REG_SZ    DriveX

End of search: 1 match(es) found.

By using the key from the above output, the command below can be created. The command removes this key and all entries under this key.

reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{49476EF1-1FF2-4735-8D84-9453D4B90341}" /f

References

0

subst drives are like removable storages and if you delete a file from that type of drive, it will be deleted permanently; these drives don't have a Recycle Bin folder.

DMA57361
  • 18,793
mohsen
  • 11