Map a folder to a drive in Windows
 
  March 18, 2019

An old DOS command will allow us to map a directory to a drive in windows. This could be useful in many scenarios (). There are two commands that we can use:

subts

 subts

            

REM to create
subst X: "C:\Users\LuckyDeveloper\MyFolderToMap"
REM to delete
subst X: /D
            
            
        
  • Drive name must be followed by a whitespace
  • If the target folder has whitespace in its name, use quotes “\directory withe white spaces"
  • Notice that at the end of the command we don't use the character “\

✍️ This command expects that the folder is always present, be aware of this so you don't impair the performance of your machine

✍️ The map will reset with every restart, to keep it between restarts add it to windows start folder C:\Program Data\Microsoft\Windows\Start Menu\Programs\Startup

🔗 (WindowsKey + R, type: shell:common startup)

net use

net use D: \\SomeNetHost\c$\Users\LuckyDeveloper\MyFolderToMap

✍️ net use is more fault-tolerant about folder availability, so is better to use with network shared resources.