HOME

TheInfoList



OR:

In
computing Computing is any goal-oriented activity requiring, benefiting from, or creating computer, computing machinery. It includes the study and experimentation of algorithmic processes, and the development of both computer hardware, hardware and softw ...
, SUBST is a
command Command may refer to: Computing * Command (computing), a statement in a computer language * command (Unix), a Unix command * COMMAND.COM, the default operating system shell and command-line interpreter for DOS * Command key, a modifier key on A ...
on the
DOS DOS (, ) is a family of disk-based operating systems for IBM PC compatible computers. The DOS family primarily consists of IBM PC DOS and a rebranded version, Microsoft's MS-DOS, both of which were introduced in 1981. Later compatible syste ...
,
IBM International Business Machines Corporation (using the trademark IBM), nicknamed Big Blue, is an American Multinational corporation, multinational technology company headquartered in Armonk, New York, and present in over 175 countries. It is ...
OS/2 OS/2 is a Proprietary software, proprietary computer operating system for x86 and PowerPC based personal computers. It was created and initially developed jointly by IBM and Microsoft, under the leadership of IBM software designer Ed Iacobucci, ...
,
Microsoft Windows Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
and
ReactOS ReactOS is a Free and open-source software, free and open-source operating system for i586/amd64 personal computers that is intended to be binary-code compatibility, binary-compatible with computer programs and device drivers developed for Wind ...
operating system An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs. Time-sharing operating systems scheduler (computing), schedule tasks for ...
s used for substituting paths on physical and logical drives as virtual drives.


Overview

In
MS-DOS MS-DOS ( ; acronym for Microsoft Disk Operating System, also known as Microsoft DOS) is an operating system for x86-based personal computers mostly developed by Microsoft. Collectively, MS-DOS, its rebranding as IBM PC DOS, and a few op ...
, the SUBST command was added with the release of MS-DOS 3.1. The command is similar to
floating drive In computer data storage, drive letter assignment is the process of assigning alphabetical identifiers to volumes. Unlike the concept of UNIX mount points, where volumes are named and located arbitrarily in a single hierarchical namespace, driv ...
s, a more general concept in operating systems of
Digital Research Digital Research, Inc. (DR or DRI) was a privately held American software company created by Gary Kildall to market and develop his CP/M operating system and related 8-bit, 16-bit and 32-bit systems like MP/M, Concurrent DOS, FlexOS, Multiuser ...
origin, including
CP/M-86 CP/M-86 is a discontinued version of the CP/M operating system that Digital Research (DR) made for the Intel 8086 and Intel 8088. The system commands are the same as in CP/M-80. Executable files used the relocatable .CMD file format. Digital Re ...
2.x, Personal CP/M-86 2.x,
Concurrent DOS Multiuser DOS is a real-time multi-user multi-tasking operating system for IBM PC-compatible microcomputers. An evolution of the older Concurrent CP/M-86, Concurrent DOS and Concurrent DOS 386 operating systems, it was originally developed by ...
,
Multiuser DOS Multiuser DOS is a real-time multi-user multi-tasking operating system for IBM PC-compatible microcomputers. An evolution of the older Concurrent CP/M-86, Concurrent DOS and Concurrent DOS 386 operating systems, it was originally developed by ...
, System Manager 7,
REAL/32 Multiuser DOS is a real-time multi-user multi-tasking operating system for IBM PC-compatible microcomputers. An evolution of the older Concurrent CP/M-86, Concurrent DOS and Concurrent DOS 386 operating systems, it was originally developed by ...
, as well as
DOS Plus DOS Plus (erroneously also known as DOS+) was the first operating system developed by Digital Research's OEM Support Group in Newbury, Berkshire, UK, first released in 1985. DOS Plus 1.0 was based on CP/M-86 Plus combined with the PCM ...
and DR DOS (up to 6.0). DR DOS 6.0 includes an implementation of the command.DR DOS 6.0 User Guide Optimisation and Configuration Tips
/ref> The command is also available in
FreeDOS FreeDOS (formerly PD-DOS) is a free software operating system for IBM PC compatible computers. It intends to provide a complete MS-DOS-compatible environment for running Legacy system, legacy software and supporting embedded systems. FreeDOS ca ...
and
PTS-DOS PTS-DOS (aka PTS/DOS) is a disk operating system, a DOS clone, developed in Russia by PhysTechSoft and Paragon Technology Systems. History and versions PhysTechSoft was formed in 1991 in Moscow, Russia by graduates and members of MIPT, inf ...
. The Windows SUBST command is available in supported versions of the
command line interpreter A command-line interface (CLI) is a means of interacting with software via commands each formatted as a line of text. Command-line interfaces emerged in the mid-1960s, on computer terminals, as an interactive and more user-friendly alternativ ...
cmd.exe cmd.exe, a.k.a. Command Prompt, is a shell program on later versions of Windows ( NT and CE families), OS/2,, eComStation, ArcaOS, and ReactOS. In some versions of Windows ( CE .NET 4.2, CE 5.0 and Embedded CE 6.0) it is referred to as ...
. In
Windows NT Windows NT is a Proprietary software, proprietary Graphical user interface, graphical operating system produced by Microsoft as part of its Windows product line, the first version of which, Windows NT 3.1, was released on July 27, 1993. Original ...
, SUBST uses DefineDosDevice()
/code> to create the disk mappings. The
JOIN Join may refer to: * Join (law), to include additional counts or additional defendants on an indictment *In mathematics: ** Join (mathematics), a least upper bound of sets orders in lattice theory ** Join (topology), an operation combining two topo ...
command is the "opposite" of SUBST, because JOIN will take a drive letter and make it appear as a directory. Some versions of
MS-DOS MS-DOS ( ; acronym for Microsoft Disk Operating System, also known as Microsoft DOS) is an operating system for x86-based personal computers mostly developed by Microsoft. Collectively, MS-DOS, its rebranding as IBM PC DOS, and a few op ...
COMMAND.COM support the undocumented internal TRUENAME command which can display the "true name" of a file, i.e. the fully qualified name with drive, path, and extension, which is found possibly by name only via the
PATH A path is a route for physical travel – see Trail. Path or PATH may also refer to: Physical paths of different types * Bicycle path * Bridle path, used by people on horseback * Course (navigation), the intended path of a vehicle * Desir ...
environment variable, or through SUBST, JOIN and ASSIGN filesystem mappings.


Syntax

This is the command syntax in
Windows XP Windows XP is a major release of Microsoft's Windows NT operating system. It was released to manufacturing on August 24, 2001, and later to retail on October 25, 2001. It is a direct successor to Windows 2000 for high-end and business users a ...
to associate a path with a drive letter: SUBST rive1: [drive2:ath">rive2:">rive1: [drive2:ath SUBST drive1: /D


Parameters

*drive1: – Specify a virtual drive to which to assign a path. *[drive2:]path – Specify a physical drive and path to assign to a virtual drive. */D – Delete a substituted (virtual) drive.


Examples


Mapping a drive

This means that, for example, to map C:'s root to X:, the following command would be used at the
command-line interface A command-line interface (CLI) is a means of interacting with software via command (computing), commands each formatted as a line of text. Command-line interfaces emerged in the mid-1960s, on computer terminals, as an interactive and more user ...
: C:\>SUBST X: C:\ Upon doing this, a new drive called X: would appear under the ''My Computer'' virtual folder in
Windows Explorer File Explorer, previously known as Windows Explorer, is a file manager application and default desktop environment that is included with releases of the Microsoft Windows operating system from Windows 95 onwards. It provides a graphical user i ...
.


Unmapping a drive

To unmap drive X: again, the following command needs to by typed at the command prompt: C:\>SUBST X: /D


Custom label

A custom label can be assigned to a drive letter created in this way by way of a registry key, which can be created by renaming (select "rename" from the drive letter context menu or press ) the SUBST drive in Windows Explorer/My Computer. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\DriveIcons\M\DefaultLabel\ (DefaultValue) = ''Your Drive Label'' "M" represents the drive letter to assign a custom label to. However, labels created for SUBST drives in this manner are overridden by the label of the host drive/partition: the custom labels are only used if the host drive has no label. One may then: # Delete the host's drive label; # Create the proper registry keys for the SUBST drive letter; # Create the proper registry keys for the host drive letter (optional, works around the host drive label override caveat); # Re-create the SUBST drive to see label changes applied. Note that the LABEL command is NOT able to change the label name of a drive letter created using subst. LABEL is one of several commands that only work on physical drives.


Persisting across reboots

Drive letters mapped with the command are not available during system startup for services nor do they persist across a reboot.


Registry (DOS Devices)

The DOS Devices mechanism that underlies subst can be set in registry. This way, the mapped drives are usable immediately during startup. Create a new registry entry ''"String Value"'' in the following key: :HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices The name should be  "X:"  where ''X'' is the drive letter. The value should be the path in one of the following NT Object Manager forms: *\??\C:\some\directory (preferred) *\DosDevices\C:\some\directory (long version of the former) * \Device\Mup\127.0.0.1\C$\some\directory (discouraged, as this goes through SMB share) There are tools available to make the necessary changes for the user, including . The relative to this thematic registry key is HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices. It defines mapping of drive letters into particular hard disk partitions, similar to /etc/fstab on a
Unix Unix (, ; trademarked as UNIX) is a family of multitasking, multi-user computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, a ...
system. It also can be edited manually, but only at that time while that particular installed Window operation system is "inactive". So that, for example, if you currently boot from "D:\Windows" then you can edit the HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices key of Windows that is installed in a "C:\Windows" folder, for an instance by doing the following actions: # run command: reg load hklm\$system C:\WINDOWS\system32\config\system # run command: regedit.exe # edit registry key HKEY_LOCAL_MACHINE\$system\MountedDevices
(that represents the HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices registry key of the Windows instance that is installed in C:\WINDOWS) # close regedit.exe # run command: reg unload hklm\$system (to complete the editing procedure)


Importing reg file

The easiest way to do this is to create a registry file (.reg), and double click the file to import the settings into the registry. Here is an example registry file. REGEDIT4 KEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices"F:"="\\??\\D:\\Mount\\db" "G:"="\\??\\D:\\Mount\\log" After configuring the registry the computer must be rebooted for the changes to take effect.


Run on boot (batch)

Create a batch file to run the built-in SUBST command to create a virtual drive letter for the existing mount points and place it in the user accounts startup folder. This is not preferred, as the mapping only appears at the end of user logon. Here is an example:
@ECHO off SUBST f: d:\mount\db SUBST g: d:\mount\log The user must log off and back on or the service must be restarted for the changes to take effect.


Run on boot (registry)

Edit the registry to run the built-in subst command during computer startup or user logon by leveraging the appropriate Run registry key. The easiest way to do this is to create a registry file (.reg), and double click the file to import the settings into the registry. This is not preferred, as the mapping only appears at the end of bootup. Example to run during computer boot REGEDIT4 KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"F Drive"="SUBST f: d:\\mount\\db" "G Drive"="SUBST g: d:\\mount\\log" The computer must be rebooted for the changes to take effect. Example of user logon REGEDIT4 KEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"F Drive"="SUBST f: d:\\mount\\db" "G Drive"="SUBST g: d:\\mount\\log" The user must log off and back on for the changes to take effect.


Limitations

* Windows actions which act on disks at the physical layer are not possible. * Since (at least) Microsoft Windows XP SP2 autorun.inf files present in the new drive letter are ignored; thus, AutoRun/
AutoPlay AutoPlay, a feature introduced in Windows 98, examines newly discovered removable media and devices and, based on content such as pictures, music or video files, launches an appropriate application to play or display the content. It is closely r ...
does not work on drive letters created in this way. In addition, assigning a custom icon or label to the drive letter created this way via autorun.inf does not work. A custom label assigned to the drive letter created with subst only appears if the source drive/volume does not have a volume label set (check and set with the
label A label (as distinct from signage) is a piece of paper, plastic film, cloth, metal, or other material affixed to a container or product. Labels are most often affixed to packaging and containers using an adhesive, or sewing when affix ...
command). * Starting with
Windows Vista Windows Vista is a major release of the Windows NT operating system developed by Microsoft. It was the direct successor to Windows XP, released five years earlier, which was then the longest time span between successive releases of Microsoft W ...
, deleted files are immediately deleted permanently, and are not moved to the Recycle Bin. Prior to Windows Vista (in Windows XP, for example) files from substituted "disks" were moved to the Recycle Bin when deleted. A registry entry could be added to re-enable the Recycle Bin. * Files or folders on drives created this way may have different access rights. Software installations may not work correctly, because the Config.msi directory created by the windows installer can not be accessed properly. Log files can not be written although the executing user has administrative rights.


See also

*
Drive letter assignment In computer data storage, drive letter assignment is the process of assigning alphabetical identifiers to volumes. Unlike the concept of UNIX mount points, where volumes are named and located arbitrarily in a single hierarchical namespace, driv ...
*
Floating drive In computer data storage, drive letter assignment is the process of assigning alphabetical identifiers to volumes. Unlike the concept of UNIX mount points, where volumes are named and located arbitrarily in a single hierarchical namespace, driv ...
* Load drive *
NTFS symbolic link NTFS links are the abstraction used in the NTFS file system—the default file system for all Microsoft Windows versions belonging to the Windows NT family—to associate pathnames and certain kinds of metadata, with entries in the NTFS Master ...


References


Further reading

* * *


External links


subst , Microsoft Docspsubst tool for persistent mappings
— a GUI tool with persistent drive-mapping option. {{Windows commands External DOS commands OS/2 commands Storage virtualization