SUBST

subst
Developer(s)Microsoft, IBM, Digital Research, ReactOS Contributors
Initial release1985, 39–40 years ago
Operating systemMS-DOS, PC DOS, SISNE plus, OS/2, eComStation, ArcaOS, DR DOS, ROM-DOS, PTS-DOS, FreeDOS, Windows, ReactOS
PlatformCross-platform
TypeCommand
Websitedocs.microsoft.com/en-us/windows-server/administration/windows-commands/subst

In computing, SUBST is a command on the DOS, IBM OS/2,[1] Microsoft Windows and ReactOS[2] operating systems used for substituting paths on physical and logical drives as virtual drives.

Overview

In MS-DOS, the SUBST command was added with the release of MS-DOS 3.1.[3] The command is similar to floating drives, a more general concept in operating systems of Digital Research origin, including CP/M-86 2.x, Personal CP/M-86 2.x, Concurrent DOS, Multiuser DOS, System Manager 7, REAL/32, as well as DOS Plus and DR DOS (up to 6.0). DR DOS 6.0 includes an implementation of the SUBST command.[4] The command is also available in FreeDOS[5] and PTS-DOS.[6] The Windows SUBST command is available in supported versions of the command line interpreter cmd.exe.[7] In Windows NT, SUBST uses DefineDosDevice() to create the disk mappings.

The JOIN 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 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 environment variable, or through SUBST, JOIN and ASSIGN filesystem mappings.

Syntax

This is the command syntax in Windows XP to associate a path with a drive letter:

SUBST [drive1: [drive2:]path]
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:

C:\>SUBST X: C:\

Upon doing this, a new drive called X: would appear under the My Computer virtual folder in Windows Explorer.

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[citation needed] 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 F2) 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:

  1. Delete the host's drive label;
  2. Create the proper registry keys for the SUBST drive letter;
  3. Create the proper registry keys for the host drive letter (optional, works around the host drive label override caveat);
  4. 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.[8] LABEL is one of several commands that only work on physical drives.[9]

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 psubst.

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 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:

  1. run command: reg load hklm\$system C:\WINDOWS\system32\config\system
  2. run command: regedit.exe
  3. 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)
  4. close regedit.exe
  5. 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

[HKEY_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

[HKEY_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

[HKEY_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.[10]
  • Since (at least) Microsoft Windows XP SP2 autorun.inf files present in the new drive letter are ignored; thus, AutoRun/AutoPlay 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 command).
  • Starting with Windows Vista, 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.[11]
  • 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

References

  1. ^ "JaTomes Help - OS/2 Commands". www.jatomes.com. Archived from the original on 2019-04-14.
  2. ^ "Reactos/Reactos". GitHub. 22 November 2021.
  3. ^ Wolverton, Van (2003). Running MS-DOS Version 6.22 (20th Anniversary Edition), 6th Revised edition. Microsoft Press. ISBN 0-7356-1812-7.
  4. ^ DR DOS 6.0 User Guide Optimisation and Configuration Tips
  5. ^ "FreeDOS 1.2 Updates Group - FreeDOS Base". Ibiblio.org. Retrieved 2022-09-04.
  6. ^ "PTS-DOS 2000 Pro User Manual" (PDF). Buggingen, Germany: Paragon Technology GmbH. 1999. Archived (PDF) from the original on 2018-05-12. Retrieved 2018-05-12.
  7. ^ "Subst". learn.microsoft.com. 11 September 2009.
  8. ^ "Change network drive label by command line".
  9. ^ "Subst". 3 February 2023.
  10. ^ "Microsoft.com". Microsoft.
  11. ^ "Windows - How to make SUBST mapping persistent across reboots?".

Further reading

Read other articles:

Confederate States Army general and Ku Klux Klan leader (1821–1877) This article is about the Confederate general. For other uses, see Nathan Bedford Forrest (disambiguation). Nathan Bedford ForrestPortrait c. 1862-65 by unknown photographer (Brady-Handy collection, Library of Congress)Birth nameNathan Bedford ForrestNickname(s)Old Bed[1]Wizard of the Saddle[2]Born(1821-07-13)July 13, 1821Chapel Hill, Tennessee, U.S.DiedOctober 29, 1877(1877-10-29) (aged 56)Memphi...

 

Alfred T. Goshorn circa 1876 Trophy Vase presented to Alfred T. Goshorn, 1876 International Centennial Exposition Wikimedia Commons has media related to Alfred T. Goshorn. Alfred Traber Goshorn (July 15, 1833 – 1902) was a Cincinnati, Ohio businessman and booster who served as Director-General of the 1876 Centennial Exposition in Philadelphia. That was the first world's fair in the United States and so resounding a success that Queen Victoria knighted Goshorn and the leaders of Europe p...

 

Viaduc d'Austerlitz Viaduc d'Austerlitz adalah dek tunggal, lengkungan baja, jembatan rel yang melintasi Seine di Paris. Penggunaannya hanya didedikasikan untuk Jalur 5 Metro Paris. Ini menghubungkan Gare d'Austerlitz di Rive Gauche ke Quai de la Rapée di sisi lain sungai.[1] Referensi ^ Le viaduc d'Austerlitz - Paris 12e et 13e lbsPariwisata di ParisLandmark Arc de Triomphe Arc de Triomphe du Carrousel Arènes de Lutèce Bourse Katakomba Conciergerie Menara Eiffel Gare d'Austerlitz ...

Estadio OlímpicoEn ibarraFull nameEstadio Olímpico Ciudad de IbarraFormer namesEstadio Olímpico MunicipalEstadio Olímpico Ciudad de IbarraLocationAvenida Víctor Manuel Peñaherrera S/N y Jaime RoldósIbarra, EcuadorCoordinates0°21′37″N 78°07′07″W / 0.36021°N 78.11853°W / 0.36021; -78.11853OwnerFederación Deportiva de ImbaburaOperatorFederación Deportiva de ImbaburaCapacity18,600Field size100 x 66 mConstructionOpenedAugust 4, 1988[1]RenovatedA...

 

lon_sec = lat_dir = region = lon_dir = lat_sec = lat_min = CoordScale = скасований = lon_min = Успенська церквацерква Успіння Пресвятої Богородиці Храм до пожежі Храм до пожежі 50°51′23″ пн. ш. 31°29′01″ сх. д. / 50.856639° пн. ш. 31.483694° сх. д. / 50.856639; 31.483694Координати: 50°51′23″ пн. ш. 31

 

This article may be written from a fan's point of view, rather than a neutral point of view. Please clean it up to conform to a higher standard of quality, and to make it neutral in tone. (May 2017) (Learn how and when to remove this template message) Greg (left) and Wirt, two half-brothers, along with Beatrice the bluebird and Greg's pet frog The American animated television miniseries Over the Garden Wall features a cast of fictional characters created by Patrick McHale. The series revolves...

العلاقات البرازيلية السنغالية البرازيل السنغال   البرازيل   السنغال تعديل مصدري - تعديل   العلاقات البرازيلية السنغالية هي العلاقات الثنائية التي تجمع بين البرازيل والسنغال.[1][2][3][4][5] مقارنة بين البلدين هذه مقارنة عامة ومرجعية للدولتين: و...

 

Haçatala is a village and municipality in the Qusar Rayon of Azerbaijan. It has a population of 271.[citation needed] The municipality consists of the villages of Haçatala and Gican.[1] References ^ Belediyye Informasiya Sistemi (in Azerbaijani). Archived from the original on September 24, 2008. vteQusar DistrictCapital: Qusar Arçan Aşağı İmamqulukənd Aşağı Ləgər Aşağı Qələnxur Atlıxan Avaran Avaranqışlaq Bala Qusar Bədirqala Bədişqala Böyük Muruq Caq...

 

Sherman IslandSherman Island from the air. The bridge at bottom connects it to Antioch. The small D-shaped island at the top right is Decker Island.Sherman IslandShow map of Sacramento-San Joaquin River DeltaSherman IslandShow map of San Francisco Bay AreaSherman IslandShow map of CaliforniaGeographyLocationSacramento–San Joaquin River DeltaCoordinates38°03′34″N 121°44′00″W / 38.0593642°N 121.7332878°W / 38.0593642; -121.7332878Adjacent toSacramento-San J...

This article contains content that is written like an advertisement. Please help improve it by removing promotional content and inappropriate external links, and by adding encyclopedic content written from a neutral point of view. (July 2023) (Learn how and when to remove this template message) KhetKhet board with the Classic setupDesignersLuke Hooper, Professor Michael Larson, and Del SeguraPublishersInnovention Toys, LLCPlayers2Setup time5 minutesPlaying time10-30 minutesChanceNoneAge range...

 

County in Missouri, United States Not to be confused with Benton, Missouri. County in MissouriBenton CountyCountyThe Benton County Courthouse in WarsawLocation within the U.S. state of MissouriMissouri's location within the U.S.Coordinates: 38°18′N 93°17′W / 38.3°N 93.29°W / 38.3; -93.29Country United StatesState MissouriFoundedJanuary 3, 1835Named forThomas Hart BentonSeatWarsawLargest cityWarsawArea • Total753 sq mi (1,950 ...

 

Railway station in Sydney, New South Wales, Australia WahroongaNorthbound viewGeneral informationLocationRailway Parade, WahroongaCoordinates33°43′03″S 151°07′01″E / 33.71751°S 151.11698°E / -33.71751; 151.11698Elevation197 metres (646 ft)Owned byTransport Asset Holding EntityOperated bySydney TrainsLine(s)North ShoreDistance22.77 kilometres (14.15 mi) from CentralPlatforms2 (1 island)Tracks2ConnectionsBusConstructionStructure typeGroundOther info...

Entalpi standar Boudouard dalam berbagai suhu Reaksi Boudouard adalah kesetimbangan kimia antara karbon monoksida dengan karbon dioksida pada suhu tertentu. Reaksi ini merupakan reaksi disproporsionasi karbon monoksida menjadi karbon dioksida dan grafit:[1] 2CO CO2 + C Reaksi ini bersifat eksotermik. Namun, negativitas entalpi standar reaksi Boudouard berkurang jika suhunya meningkat (lihat grafik di kanan).[2] Reaksi ini dinamai dari kimiawan Prancis Octave Leopold Boudouard ...

 

Polisi Wanita (Polwan)Dibentuk1 September 1948NegaraIndonesiaCabang PolriBagian dariPolriSitus webwww.polri.go.id Polisi wanita (disingkat Polwan) adalah satuan polisi khusus yang berjenis kelamin wanita. Sejarah Monumen Polisi Wanita Indonesia dibangun di Bukittinggi, tempat pertama kali terbentuknya polwan Indonesia pada 1948. Polwan di Indonesia lahir pada 1 September 1948, berawal dari Kota Bukittinggi, Sumatera Barat, tatkala Pemerintahan Darurat Republik Indonesia (PDRI) menghadapi Agre...

 

Kerk van Maria, Hulp der Christenen kan verwijzen naar: Maria Hulp der Christenen - titel van de Heilige Maria Kerken Kerk van Maria, Hulp der Christenen (Wiesbaden) - Duitsland Bedevaartskerk Maria Hulp der Christenen - Slovenië Basiliek Maria Hulp der Christenen - Italië Santa Maria Ausiliatrice in Via Tuscolana - Italië Maria Helpsterkerk (Berleur) - België Onze-Lieve-Vrouw-van-Bijstand-der-Christenenkerk (Sint-Niklaas) - België Bekijk alle artikelen waarvan de titel begint met K...

2021 single by Years & Years StarstruckSingle by Years & Yearsfrom the album Night Call Released8 April 2021GenreSynth-pop[1]Length3:27LabelPolydorSongwriter(s) Clarence Coffee Jr. Mark Ralph Nathaniel Ledwidge Olly Alexander Producer(s) DetoNate Mark Ralph Years & Years singles chronology It's a Sin (2021) Starstruck (2021) The Edge of Glory (2021) Kylie Minogue singles chronology Real Groove(2020) Starstruck (Kylie Minogue Remix)(2021) A Second to Midnight(2021) Musi...

 

Questa voce sull'argomento cestisti cinesi è solo un abbozzo. Contribuisci a migliorarla secondo le convenzioni di Wikipedia. Segui i suggerimenti del progetto di riferimento. Zhao Jiwei Nazionalità  Cina Altezza 185 cm Pallacanestro Ruolo Playmaker Squadra  Liaoning F. Leopards Carriera Squadre di club 2013- Liaoning F. Leopards Nazionale 2013 Cina U-192015- Cina Palmarès  Campionati asiatici Oro Cina 2015  Giochi asiatici Bronzo Hangzhou 2022 Il simbolo → ...

 

American academic E. T. JaynesEdwin Thompson Jaynes (1922–1998), photo taken circa 1960.Born(1922-07-05)July 5, 1922Waterloo, IowaDiedApril 30, 1998(1998-04-30) (aged 75)St. Louis, MissouriEducationCornell CollegePrinceton UniversityKnown forMaximum entropy thermodynamicsBayesian theoryJaynes–Cummings modelScientific careerFieldsPhysicistInstitutionsWashington University in St. LouisThesisAn electronic theory of ferroelectricity (1948)Doctoral advisorEugene Wigner Jayne...

American politician (1798–1866) Francis L. HawksBornFrancis Lister Hawks(1798-06-10)June 10, 1798New Bern, North CarolinaDiedSeptember 26, 1866(1866-09-26) (aged 68)New York, New YorkAlma materNorth Carolina University Francis Lister Hawks (June 10, 1798 – September 26, 1866) was an American writer, historian, educator and priest of the Episcopal Church. After practicing law with some distinction (and a brief stint as politician in North Carolina), Hawks became an Episcopal prie...

 

Nativisme kan verwijzen naar: Aangeboren kennis Nativisme (politiek) Bekijk alle artikelen waarvan de titel begint met Nativisme of met Nativisme in de titel. Dit is een doorverwijspagina, bedoeld om de verschillen in betekenis of gebruik van Nativisme inzichtelijk te maken. Op deze pagina staat een uitleg van de verschillende betekenissen van Nativisme en verwijzingen daarnaartoe. Bent u hier via een pagina in Wikipedia terechtgekomen? Pas dan de verwijzing naar deze...

 

Strategi Solo vs Squad di Free Fire: Cara Menang Mudah!