In Windows, we usually need to traverse the long chain of a path to open a specific file. If we need to open that file frequently, what is the easiest process we usually adopt? Isn’t it making Desktop Shortcuts? However, in Windows there is another way we can do this; we can map any folder as a drive. This method is very advantageous for long file path issues.
Sometimes in our working environment, we stuck into long file path issue. This often occurs when we are working on a company which maintains an organized file structure in massive shared computers, in that scenario, on opening a file we may face the dreaded “File name/path is too long” message. The message is usually displayed when the file path exceeds 256 characters. However, this restriction can be resolved by mapping any folder location as a drive. But, how? Today, we will learn how can we map any folder as a drive in windows.
Mapping folder location as a drive
There have three methods of my knowledge to map any folder as a drive, just take a look at each of them.
Using Command Prompt
How to open command prompt
Are you familiar with command prompt environment? If you do not then follow the following instructions:
Press “Windows logo key and R” to open the “Run” dialog box and type “cmd” in the search box and hit the enter key. A black screen window will appear and that is the command prompt.
Type the following command to map a specific folder location to a virtual drive in windows.
To create a virtual drive type “Subst [drive name] [folder location]” and hit the enter key. In this command “drive name” is the drive letter you want to assign suppose ‘y:’ and the “folder location” is the path of the folder you desired to map to the drive.
Drawbacks of Subst command
However, this ‘subst’ command is not a full proof permanent solution. The drive created by ‘subst’ command disappears after the computer takes a reboot. There is no normal way you can prevent disappearing off the created drive. To make it permanent, you need to apply the following trick.
A solution of the Subst problem
Making the batch file
Though we can’t prevent the drive from disappearing after a reboot but, we can create it as soon as the Windows starts up. How? We can make a batch file which will run at the system startup and create our desired virtual drive every time the Windows starts up. Now, see how we can do all these things. Open the Notepad application and type the following code:
subst y: d:\movies
Save this file with the desired file name and a ‘.bat’ extension.
Making the batch file autorun on system startup
Now, open the run dialog box and type “shell: startup” and hit the enter key, the start-up folder will open. Now, copy that newly created batch file and paste it into the start-up folder and you are done. Now, every time you reboot your system, your virtual drive will be intact.
Using Windows Task Scheduler
The alternative way you can do the same task is using Windows Task Scheduler. To open Windows Task Scheduler, you can use either Windows God Mode or Windows Search (Windows logo key+ S) console. After opening the Task Scheduler open the “Create Task” link provided at the right pane.
A window will open with a bunch of options and tabs. In the first tab provide the ‘Task Name’ and move to the next tab ‘Trigger’. In this tab click the “New” button and select ‘At Log On’ from the drop-down list under “begin the task” section and select the “specific user” radio button. Then check the “Enable” option and click “OK” button.
Now, move to the next tab “Action”, click on the “New” button and select ‘Start a Program'(it is the default value) under “Action” section. Now, type “C:\Windows\System32\cmd.exe” under “Program/Script” box and type “/c subst i: d:/movie” at the “add arguments” box; where ‘i:’ is the drive letter you want to assign and “d:/movie” is the folder location used for mapping. Now, click ‘ok’ to save ‘Action’ settings and again click the ‘ok’ button to save your task. Now, every time you log on, the task scheduler will create your virtual drive.
Using Windows Registry
This method is quite tricky. It is about Windows Registry tweaking. If you are familiar with registry editing then it is the shortest and simplest technique to map a folder as a drive, however, newbies can also try this. Follow the instructions minutely to achieve the result.
The steps are:
- Open the “Run”( Windows logo key + R) dialog box.
- Type “Regedit” and click the “ok” button and Windows registry will be at your disposal.
- Now, locate the follow the following path to open “DOS Device” key, “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices”.
- Click on “Edit” menu, then “New” and create a “String value”.
- Provide the drive letter (for example Y:) as name and “\??\ folder location” (for example ‘\??\d:\movie’) as value.
- Now, exit from the registry editor and when you reboot your system, you will see these changes.
That was all about mapping a folder a virtual drive. If you find this article helpful then pass it to your friends.