Create Permanent Virtual Drives with SUBST on Windows 11

Earlier we posted about how to create virtual drives on Windows 11 PC without needing any third-party tools. This was done using the ages old SUBST command which existed even on the old Windows 98 computers. But the problem with SUBST command is that the virtual drives (actually folders mapped to a drive letter) are removed after a system reboot. If you want to make these virtual drives permanent, then you can add the SUBST commands to a batch script and make it automatically run at Windows startup.

Here is how you can create virtual drives using the SUBST command on Windows 11 in such a manner that the virtual drives automatically reappear even after the system reboot:

  1. Use a plain text editor such as Windows Notepad (or Notepad++) to create a batch script with the SUBST commands. For example, it could have the following content:
    @ECHO OFF
    SUBST T: C:\Temp
    SUBST Y: C:\Windows
  2. Save this file somewhere in a convenient location on your PC as virtual-drive.bat.Auto Virtual Drive on Windows 11
  3. Press the hotkey Win+R to open the  Run dialog. In the Run dialog, type regedit and press Enter. This will start Windows Registry Editor.
  4. In the Registry Editor, navigate to the key HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run.
  5. Right-click on the right-side pane and choose to create a new string type entry. Give it a name VirtualDrives, and set its value to the path of the batch script, for example, C:\SMD\virtual-drive.bat.Auto Virtual Drive on Windows 11
  6. Now each time when your computer boots, it will automatically create the virtual drives specified in the batch script as shown above.

Suppose if you no longer want to have these virtual drives on your Windows 11 PC, then what you are going to do? It is very easy to remove this setup. All you have to do is delete the batch script virtual-drive.bat from your Windows PC. Alternatively, you can edit this batch script file and remove all the contents.