Substituting a Directory for a Drive

You may have had such an imagination: As MS-DOS directory structure is organized in the form of trees, of course a relative file specifier can specify a file wherever the referrer program locates if the tree holds the whole set of related files in their original directory layout. Yes, it is true. Thus, there is a new discovery: You can even emulate a disk that contains the same directory structure as the target directory. Then I want to tell you, you can do that easily by simply running the program SUBST.EXE. I think you may be interested in this. Let me talk about it to you.

If you are using MS-DOS, just type at the command prompt: "SUBST <drive1:> <drive2:[path]>", where "dirve1" is the letter of the drive to which you want to assign a path, and "drive2:[path]" is the target directory you want to emulate. If you are using Microsoft Windows, just run that command in your "Run" dialog box.

Notice that the virtual drive holds only the directory struture, that is, the drive hasn't got an FAT and cannot be locked by applications (that is to say, it cannot be accessed by sectors). The free space and the label of the drive are reported according to the host drive's (which contains the target directory).

To delete a substituted drive, just run the command "SUBST /d <drive:>", where "drive" is the drive you emulated using SUBST.EXE. You can also use the "SUBST" command to see the status of substituted drives.

If you are using Microsoft Windows, you can find that there is a tool provided with Windows: Assign a network directory to a drive. You can call out the tool using "Tools->Assign Network Drives" menu item on an Windows Explorer browsing window. This function is not provided with MS-DOS.

 
C:\Documents and Settings\Decheng\Desktop>subst /?
Associates a path with a drive letter.

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.

C:\Documents and Settings\Decheng\Desktop>
Return to MS-DOS for Beginners