Tuesday, May 21, 2019

Creating Virtual drive for Folder using Subst Command in Windows

Using subst command, you can make virtual drive for any your desired folder. This can be usefull if you need to make a game work in diskless environment where drive in server and client were mapped differently.

And this how it works :
  1. Open Command Prompt. Don't run it as administrator because it has to run on current account or you will not see it in explorer.
      2. Type and provide the following command : subst drive_letter: folder_path  
    For example : subst R: "E:\Program Files"
Or you can subst the folder without have to specifie physical drive and path of the folder. But you have to change the current directory to where the folder located.
For example :
You want to subst "Program Files" folder with path "E:\New Folder\Program Files",
you can make batch file and write in this command : Subst R: "Program Files" and place the batch file inside the "New Folder" .

NOTE:
A. Remember! You can't use existing drive letters for creating virtual drives, e.g. if you have 2 partitions C: and D:, then you can't use them for subst command.
B. If your folder path contains spaces, put the whole path in double-quotes ("").
C. You should not use chkdsk, diskcomp, diskcopy, format, label and recover commands on virtual drives created using subst command as these virtual drives are not real and these commands either will not work or can cause problems for the actual drives where the folders reside.
D. If you can't run an application on Subst drive then change the following registry key :
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System
Key: EnableLUA , change value data from 1 to 0. Then reboot to take effect of the registry change.
E. If you want to delete the subst drive, reboot the pc or type this command :
subst drive_letter: /D
for example : subst R: /D



No comments:

Post a Comment