About a year ago I got my brand new Aviva Solutions laptop. A nice HP/Compaq machine with a 100 GB harddrive and a pre-installed version of Windows XP on it.
At the time I didn't have the time to re-install XP and properly configure my machine. It didn't bother me much, mostly because I use virtual machines for most of my work. After a while though one thing started bugging me: the 100 GB harddrive only has one logical drive on it. In the past I've gotten used to having all my data, documents, etc. on a D: drive separated from all OS and program files on the C: drive.
I just can't get used to having data, OS and program files all intermingled on a single C: drive, so I had to find a solution and get my D: drive back. Of course I could start clean and re-partition the entire drive into a C: and D: drive and re-install Windows or I could try my luck with a partitioning tool. But I opted for another less involved solution: creating a virtual drive pointing to a folder on my C: drive.
I knew this is possible using the DOS command SUBST [drive1: [drive2:]path], but this is only a temporary solution: After rebooting the command must be run again. Now I can hear you thinking: "Just put the command in a cmd or bat file and have Windows run it at startup." This however doesn't work for applications that need data from the virtual disk before the command runs.
After some investigation on the web I found the solution: As with many Windows challenges the answer lies within the registry. Suppose you want to expose all files and folders within the C:\Data folder as a D: drive. To achieve this add a new string value to the registry key [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices]. The name of the value should be "D:" and the value data should be "C:\Data". Reboot your machine, and that's it! You now have a virtual drive which in almost every way behaves like a regular harddrive.
You can also put the following into a .reg file and merge it into the registry:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices]
"D:"="\\??\\C:\\Data"
Enjoy.
As promised, please find the corresponding Powerpoint slides from my last two technology sessions. I still have to clean-up the sources for the design pattern examples, so that may take a while. But I'll make sure to post these as well.