How to reference a Folder as a Drive Letter

Share this Post

While assisting a customer with a SQL 2000 Replication configuration on Windows 2003 we need to reference the \ReplData folder as a Driver Letter.  With help of Rick Rieser and Ryan Mangipano from Microsoft Windows Support team we had a simple elegant solution; Windows subst command.

— Example below creates an alias V: drive to the c:\temp\repldata folder.
C:\Temp>subst V: c:\temp\Repldata

— We can now reference the folder like a drive letter
C:\Temp>dir V:
Volume in drive V has no label.
Volume Serial Number is 206B-3D35

Directory of V:\

06/26/2011  09:08 PM    <DIR>          .
06/26/2011  09:08 PM    <DIR>          ..
2 Dir(s)  43,656,921,088 bytes free

— When done we can remove alias drive letter reference
— Contents of the folder are not deleted, just Windows reference to the V: drive
C:\Temp>subst V: /D

— As expected, folder reference is removed and can no longer be displayed
C:\Temp>dir V:
The system cannot find the path specified.

Chris Skorlinski
Microsoft SQL Server Escalation Services


Share this Post

About: ReplTalk


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.