Skip to content
Russell Keane
Main Navigation HomePosts

Appearance

Sidebar Navigation

2025

February (1)

Dynamically setting prev and next links in Vitepress

2019

November (1)

CloudFormation template failing to deploy

2018

March (1)

Subst'ing a drive in Windows 7 / 10

January (1)

Groovy - unable to resolve class

2017

October (2)

Reordering pages in LIFERAY forms

Spring / ZUUL - Failed to introspect annotated methods

June (1)

Sourcetree stuck on POST (chunked)

March (1)

Turning off Windows 10 ads

2016

December (1)

Failure to install / update ruby gems

July (2)

PostgreSQL - Casting integer to interval

piggly trace- invalid multibyte escape

June (1)

Jenkins stuck on "Retrieving Git references..."

March (1)

Jenkins & Groovy - accessing build parameters

2015

November (2)

Creating a Jenkins slave as a Windows service

Why Jenkins?

On this page

Setting up a mapped drive is great, it gives you a handy shortcut to a particular folder and a really short path when you want to refer to that folder.

You can accomplish this with a Network Drive but (I believe) this could route traffic to the network adaptor before it goes back to the actual folder you want to get to. [investigation required to prove this...]

You can also "subst" a drive, which I much prefer, as it's definitely a local only thing. It can also be accomplished very quickly and easily from a command line.

For example, if you wanted a mapped drive "W" to point to a a folder "D:\Work" you could do it thus:

shell
subst w: d:\work

The Problem ​

subst used to work absolutely fine until windows 7 (possibly even XP I think) when it stopped persisting across reboots.

Now you could add the subst command to a batch file and launch that on windows startup but a, that's not very elegant and b, the start up commands happen too late if you want to launch a service using something in the subst'd drive.

The Solution ​

It's a simple solution really. You need to add a registry key detailing the drive letter and the folder you want to map it to.

So, sticking with the example above, open up regedit and navigate to either of the following HKEY roots depending on your requirements:

  • HKEY_LOCAL_MACHINE (if you want the drive to be set up for all users)

  • HKEY_CURRENT_USER (if you want the drive to be set up for only the current user)

Then go to the following path:

shell
<HKEY root>\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices

From there add a new string value, setting the name to the drive you want to create ("W:" in our case) and the value data to the following:

shell
\??\C:\Work

The string value should end up looking like this:

dos_devices

Notes ​

Reg file ​

If you want to add this using a reg file then you'll need to escape the backslashes with an extra backslash, like this:

shell
REGEDIT4

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices]
"W:"="\\??\\C:\\Work"

Reboot ​

You'll need to do a reboot before the new drive mapping will take effect

Pager
Previous pageGroovy - unable to resolve class
Next pageCloudFormation template failing to deploy

All views expressed are my own

Copyright © 2015-present Russell Keane