Archive

Archive for the ‘Batch programming’ Category

Associate a path with a drive letter

March 16, 2009 4 comments

Use SUBST command…

SUBST [drive1: [drive2:]path]
SUBST drive1: /D

drive1:        Specifies a virtual drive to which you want to assign a path.
[drive2:]path  Specifies a physical drive and path you want to assign to
a virtual drive.
/D             Deletes a substituted (virtual) drive.

Type SUBST with no parameters to display a list of current virtual drives. An e.g. usage, create a  “p:” virtual drive for documents and settings folder path…

subst p: "C:\Documents and Settings"

To delete an existing virtual drive use…

subst /D p:

To see all existing virtual drives created…

C:\Documents and Settings>subst
N:\: => C:\
P:\: => C:\Documents and Settings

Also note that on machine restart these drives are not restored, for restoration after startup, create a batch file and put it into “Startup” folder in explorer. After a virtual drive is created, explorer shows this as an independent drive.

%d bloggers like this: