How to make SUBST mapping persistent across reboots?












159















Does Windows (XP or later) have a built-in way to create persitent drive mappings, like the ones SUBST creates? I found a 3rd party tool psubst. Is there a way to do it without 3rd party tools?










share|improve this question























  • It is possible, because psubst is just a .bat file that mucks with the registry. See @davr's answer below for details.

    – Scott Stafford
    Jan 29 '15 at 15:13













  • Caveat from the Wikipedia article in the accepted answer: "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."

    – JMD
    Jan 27 '16 at 15:26








  • 1





    @IvoFlipse, that's a good assumption in general but in this case it's just wrong. The '3rd party tool' is a 150 line batch file that provides a nice cli for modifying a registry and cleaning input to comply with subst's picky trailing slash rules, but it's just a pretty wrapper. You can do it without a program, and the README for psubst explains how. Or, see davr's answer below where he quotes the psubst README.

    – alexanderbird
    Nov 21 '16 at 20:56


















159















Does Windows (XP or later) have a built-in way to create persitent drive mappings, like the ones SUBST creates? I found a 3rd party tool psubst. Is there a way to do it without 3rd party tools?










share|improve this question























  • It is possible, because psubst is just a .bat file that mucks with the registry. See @davr's answer below for details.

    – Scott Stafford
    Jan 29 '15 at 15:13













  • Caveat from the Wikipedia article in the accepted answer: "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."

    – JMD
    Jan 27 '16 at 15:26








  • 1





    @IvoFlipse, that's a good assumption in general but in this case it's just wrong. The '3rd party tool' is a 150 line batch file that provides a nice cli for modifying a registry and cleaning input to comply with subst's picky trailing slash rules, but it's just a pretty wrapper. You can do it without a program, and the README for psubst explains how. Or, see davr's answer below where he quotes the psubst README.

    – alexanderbird
    Nov 21 '16 at 20:56
















159












159








159


62






Does Windows (XP or later) have a built-in way to create persitent drive mappings, like the ones SUBST creates? I found a 3rd party tool psubst. Is there a way to do it without 3rd party tools?










share|improve this question














Does Windows (XP or later) have a built-in way to create persitent drive mappings, like the ones SUBST creates? I found a 3rd party tool psubst. Is there a way to do it without 3rd party tools?







windows






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Aug 24 '09 at 22:53









rickrick

835388




835388













  • It is possible, because psubst is just a .bat file that mucks with the registry. See @davr's answer below for details.

    – Scott Stafford
    Jan 29 '15 at 15:13













  • Caveat from the Wikipedia article in the accepted answer: "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."

    – JMD
    Jan 27 '16 at 15:26








  • 1





    @IvoFlipse, that's a good assumption in general but in this case it's just wrong. The '3rd party tool' is a 150 line batch file that provides a nice cli for modifying a registry and cleaning input to comply with subst's picky trailing slash rules, but it's just a pretty wrapper. You can do it without a program, and the README for psubst explains how. Or, see davr's answer below where he quotes the psubst README.

    – alexanderbird
    Nov 21 '16 at 20:56





















  • It is possible, because psubst is just a .bat file that mucks with the registry. See @davr's answer below for details.

    – Scott Stafford
    Jan 29 '15 at 15:13













  • Caveat from the Wikipedia article in the accepted answer: "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."

    – JMD
    Jan 27 '16 at 15:26








  • 1





    @IvoFlipse, that's a good assumption in general but in this case it's just wrong. The '3rd party tool' is a 150 line batch file that provides a nice cli for modifying a registry and cleaning input to comply with subst's picky trailing slash rules, but it's just a pretty wrapper. You can do it without a program, and the README for psubst explains how. Or, see davr's answer below where he quotes the psubst README.

    – alexanderbird
    Nov 21 '16 at 20:56



















It is possible, because psubst is just a .bat file that mucks with the registry. See @davr's answer below for details.

– Scott Stafford
Jan 29 '15 at 15:13







It is possible, because psubst is just a .bat file that mucks with the registry. See @davr's answer below for details.

– Scott Stafford
Jan 29 '15 at 15:13















Caveat from the Wikipedia article in the accepted answer: "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."

– JMD
Jan 27 '16 at 15:26







Caveat from the Wikipedia article in the accepted answer: "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."

– JMD
Jan 27 '16 at 15:26






1




1





@IvoFlipse, that's a good assumption in general but in this case it's just wrong. The '3rd party tool' is a 150 line batch file that provides a nice cli for modifying a registry and cleaning input to comply with subst's picky trailing slash rules, but it's just a pretty wrapper. You can do it without a program, and the README for psubst explains how. Or, see davr's answer below where he quotes the psubst README.

– alexanderbird
Nov 21 '16 at 20:56







@IvoFlipse, that's a good assumption in general but in this case it's just wrong. The '3rd party tool' is a 150 line batch file that provides a nice cli for modifying a registry and cleaning input to comply with subst's picky trailing slash rules, but it's just a pretty wrapper. You can do it without a program, and the README for psubst explains how. Or, see davr's answer below where he quotes the psubst README.

– alexanderbird
Nov 21 '16 at 20:56












8 Answers
8






active

oldest

votes


















139














Well Wikipedia mentions:




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



So you can associate paths with drive letters using subst. The Persistent SUBST command (psubst) software seems to be darn handy, and they provide a solution to run it from startup:



https://code.google.com/p/psubst/#Inconstancy




Inconstancy



However restart of a system destroys a virtual disk. What to do? A
disk can be created after startup. But what to do, when a disk is
needed on early steps of a startup? For example, to run services?
There is system feature to start a virtual disk from the system
registry:



REGEDIT4 

[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerDOS Devices]
"Z:"="\??\C:\Documents and Settings\All Users\Shared Documents"


It is enough to create a text file with the extension .REG and run
it. When the next starting up of a system, the virtual disk will be
exist at logon. It needs to define a name of disk and path. Note that
each backslash in the path is doubled.




In Windows, you can run the registry editor as follows:





  1. Start » Run... (or hit Win+R)

  2. Type: regedit

  3. In Windows Vista and above, UAC will pop up, click "Yes".






share|improve this answer





















  • 5





    Nice to know, even though I don't use subst anymore. But back in the times when I did I used to simply have a batch file sitting in my Startup folder which did those things.

    – Joey
    Aug 25 '09 at 8:46






  • 2





    This is awesome. (It requires a reboot, FYI.) Our source tree has to start from a specific drive letter so that our PDBs all always align on different computers. This registry setting solves an annoyance that I have had for years with a subst disk not being there with runas which is a big annoyance if you need to (rarely) run Visual Studio under an admin account.

    – Brian Reiter
    Sep 23 '09 at 18:58






  • 3





    Joey: That solution doesn't seem to work under Windows 7. When running an application with Administrative privileges, the substituted drive is not visible to the application.

    – Dave Jarvis
    Jul 29 '12 at 19:06






  • 27





    Thanks for the solution. FYI, if you type the variable into RegEdit interactively, do not double the backslashes. That is, create a new string variable named "Z:" (without the quotes) and set the value to the string shown above except with single backslashes.

    – Crispy
    Aug 21 '12 at 20:58






  • 2





    @Devil'sAdvocate, ?? is a virtual directory in the NT object manager namespace. First it checks the logon session DOS 'devices' (really DOS devices are symbolic links to NT devices, usually located in Device) and then the Global?? DOS devices. In WinObj you'll find the logon session devices in SessionsDosDevices[logon ID]. Notice that logon session devices are all tracked in session 0 (services) for each LSA logon ID. They aren't correlated with desktop sessions. That's why if you map a drive as a limited admin it doesn't exist when elevated; it's a different logon.

    – eryksun
    Jul 20 '16 at 23:35



















72














Installing it at HKEY_CURRENT_USER has the benefit of having different setups for each user. I prefer to stick the user space setup as long as a system service dose not depend on the device.



REGEDIT4
[HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionRun]
"F Drive"="subst F: D:\mount\db"
"G Drive"="subst G: D:\mount\log"


Source: http://networkadminkb.com/KB/a446/how-to-use-drive-letters-mount-points-the-same-disk-drive.aspx






share|improve this answer





















  • 5





    +1 For showing how to do multiple mappings in one reg file. :-)

    – megaflop
    May 15 '12 at 15:37






  • 4





    +1 for the ease of this & also explaining why HKEY_CURRENT_USER. :)

    – CAD bloke
    Feb 18 '13 at 8:19






  • 1





    +1 for showing a very elegant way to automagically do it without a batch in the startup folder

    – dkellner
    Aug 3 '15 at 13:34






  • 1





    Can also do this from the command line (since XP/Windows 2000 server): reg add HKCUSOFTWAREMicrosoftWindowsCurrentVersionRun /v "F Drive" /d "subst F: D:xdb" NB only needs escaping here if it is the last character of the subst command, e.g. when the target is the root directory: "subst F: D:\"; a single there would be interpreted as escaping the " following it.

    – stevek_mcc
    Oct 12 '16 at 10:50





















40














There's an answer in the page you linked to. You don't need the third party tool, you can do it with a simple registry entry, as detailed on that page.



Create a text file named 'mapdrive.reg' with these contents:



REGEDIT4 

[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerDOS Devices]
"Z:"="\??\C:\Documents and Settings\All Users\Shared Documents"


Then should just be able to double-click on it to set up, no 3rd party tools needed.






share|improve this answer





















  • 6





    the advantage to the reg key versus the batch file is that it sets the subst drive before any other startup commands run, in case some of those need the subst drive to function

    – davr
    Aug 24 '09 at 23:37






  • 5





    @Ivo: I'd call it a healthy fear of the unknown ;)

    – Isxek
    Aug 24 '09 at 23:55






  • 6





    If doing this in regedit, make sure to use single backslashes. e.g. ??C:SomeDirectory

    – Droj
    Jul 28 '16 at 12:19



















21














I found this because I was looking for an improvement over my startup subst scripts - they worked OK, but sometimes executed after folders crashed on startup because my drive wasn't yet mapped.



First, I edited the registry, but was unable to get it to work. However, I did come across this alternative, which although it doesn't use subst does answer for me the question, "How to make SUBST mapping persistent across reboots?" Don't use subst... (insert appropriate 'computerName' and 'pathName'):



net use u: "\computerNamec$pathName" /persistent:yes


I adapted this from Hank Arnold's suggestion at this discussion of mapping local drives. I had guessed that \myComputerNamec might work, but I didn't know to apply the $.



Before you try the "net use" command, try to navigate to


\computerNamec$
to make sure you have 'computerName' correct.




share|improve this answer



















  • 2





    Excellent solution, albeit with two problems: 1) it's not visible to the local file-system, 2) permissions...

    – ashes999
    Oct 11 '11 at 15:41






  • 5





    if you use \localhostc$pathtothing it is portable across machines (or upgrades that change the computer name). A drawback of using a mapped drive on Win7+ is that different security policies apply to network drives than local, and some programs will just refuse to run off a mapped drive.

    – matt wilkie
    May 28 '13 at 6:55






  • 1





    It is visible to the file system, and it is visible to the local file system -- it's marked as a network drive, just as some drives are marked as removeable drives. That doesn't make such drives not a part of, or not visible to, the local file system -- it makes them network/removable drives in the local file system.

    – user165568
    Jan 2 '15 at 9:35






  • 1





    In testing I did for a performance issue (a couple of years back now) using the (locally) mounted network drive is also slower than using the file system (or subst etc.) directly. This is not a tremendous difference for small files or occasional use -- not like going over the actual network to another 'server' -- but it is significant.

    – HerbM
    Jan 8 '17 at 13:47



















8














Drop a batch file in your Startup folder that does all the SUBSTs that you want to do.






share|improve this answer































    5














    Since the original PSubst has some limitations and seems to be concluded by the author, I had to code a new version for my needs, fixing some problems and adding functionality and flexibility.



    Check here for PSubst version 3 batch file



    https://github.com/cyberponk/psubst



    Compatible with Windows 7, Windows 8, Windows 10, Windows Server 2012



    Note:
    This work has no intention of demeriting the original author and only came to existence because of real necessity, as follows:




    • As a newtork admin I have the constant need for SUBST´ing network drives and fiddling with different network users.


    • As not everyone is a Windows expert, i figured the automatic admin elevation with error handling would help, based on coments I read through the web.


    • As some people struggled with the arguments order, I figured it would be best for the script to work with arguments in any order.



    I can´t recall of every added functionality, but every inclusion was done purely by necessity. I am sharing the code so that others may not encounter the troubles I had. By this there is no intention other than sharing and helping.






    share|improve this answer


























    • Please, saying "A" say "B". You've siac that the original psubst has a lot of problem - please point on them if they are. On the other hand, psubst is not abandoned. It's just achieved the limit of its development. The original tool follows very simple philosophy: do something and do well. It is not overloaded with extra functionality like handling with UAC and creating additional vbs-code for doing something more. One thing can be done over the original code - some cosmetic changes to simplifing the code and improve readability.

      – jsxt
      Feb 29 '16 at 6:33











    • Editted, please review. UAC and vbs is for automatic admin elevation. I disagree on the "limit of development" comment, as all changes I made were to make the use even more simple and easy after I encountered several problems using PSUBST. I do not intend to criticise the original author, so I will not list problems, but instead I created solutions. I actually proposed to add my editions in the original github branch, but got refused, so I had to create my own branch.

      – cyberponk
      Mar 1 '16 at 16:56













    • Thank you for your fast and detailed feedback. Most probably I need have a look to your development closer.

      – jsxt
      Mar 1 '16 at 22:20











    • My hat's off to you; I've spent my time in the batch scripting trenches, and I know how painful it is. That code looks quite good.

      – SilverbackNet
      Jun 14 '17 at 19:01



















    2














    Actually, the PSUBST tool joins two different ways of creation of substituted drives in Windows. If you want to have persistent drives between startups then you can run this tool once per each drive that you need. Another way is to use the method suggested by "davr". the PSUBST tool just makes the same but allows to make it in the easier way.






    share|improve this answer































      0














      I like Visual Subst



      Makes things easy






      share|improve this answer























        Your Answer








        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "3"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f29072%2fhow-to-make-subst-mapping-persistent-across-reboots%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        8 Answers
        8






        active

        oldest

        votes








        8 Answers
        8






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        139














        Well Wikipedia mentions:




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



        So you can associate paths with drive letters using subst. The Persistent SUBST command (psubst) software seems to be darn handy, and they provide a solution to run it from startup:



        https://code.google.com/p/psubst/#Inconstancy




        Inconstancy



        However restart of a system destroys a virtual disk. What to do? A
        disk can be created after startup. But what to do, when a disk is
        needed on early steps of a startup? For example, to run services?
        There is system feature to start a virtual disk from the system
        registry:



        REGEDIT4 

        [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerDOS Devices]
        "Z:"="\??\C:\Documents and Settings\All Users\Shared Documents"


        It is enough to create a text file with the extension .REG and run
        it. When the next starting up of a system, the virtual disk will be
        exist at logon. It needs to define a name of disk and path. Note that
        each backslash in the path is doubled.




        In Windows, you can run the registry editor as follows:





        1. Start » Run... (or hit Win+R)

        2. Type: regedit

        3. In Windows Vista and above, UAC will pop up, click "Yes".






        share|improve this answer





















        • 5





          Nice to know, even though I don't use subst anymore. But back in the times when I did I used to simply have a batch file sitting in my Startup folder which did those things.

          – Joey
          Aug 25 '09 at 8:46






        • 2





          This is awesome. (It requires a reboot, FYI.) Our source tree has to start from a specific drive letter so that our PDBs all always align on different computers. This registry setting solves an annoyance that I have had for years with a subst disk not being there with runas which is a big annoyance if you need to (rarely) run Visual Studio under an admin account.

          – Brian Reiter
          Sep 23 '09 at 18:58






        • 3





          Joey: That solution doesn't seem to work under Windows 7. When running an application with Administrative privileges, the substituted drive is not visible to the application.

          – Dave Jarvis
          Jul 29 '12 at 19:06






        • 27





          Thanks for the solution. FYI, if you type the variable into RegEdit interactively, do not double the backslashes. That is, create a new string variable named "Z:" (without the quotes) and set the value to the string shown above except with single backslashes.

          – Crispy
          Aug 21 '12 at 20:58






        • 2





          @Devil'sAdvocate, ?? is a virtual directory in the NT object manager namespace. First it checks the logon session DOS 'devices' (really DOS devices are symbolic links to NT devices, usually located in Device) and then the Global?? DOS devices. In WinObj you'll find the logon session devices in SessionsDosDevices[logon ID]. Notice that logon session devices are all tracked in session 0 (services) for each LSA logon ID. They aren't correlated with desktop sessions. That's why if you map a drive as a limited admin it doesn't exist when elevated; it's a different logon.

          – eryksun
          Jul 20 '16 at 23:35
















        139














        Well Wikipedia mentions:




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



        So you can associate paths with drive letters using subst. The Persistent SUBST command (psubst) software seems to be darn handy, and they provide a solution to run it from startup:



        https://code.google.com/p/psubst/#Inconstancy




        Inconstancy



        However restart of a system destroys a virtual disk. What to do? A
        disk can be created after startup. But what to do, when a disk is
        needed on early steps of a startup? For example, to run services?
        There is system feature to start a virtual disk from the system
        registry:



        REGEDIT4 

        [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerDOS Devices]
        "Z:"="\??\C:\Documents and Settings\All Users\Shared Documents"


        It is enough to create a text file with the extension .REG and run
        it. When the next starting up of a system, the virtual disk will be
        exist at logon. It needs to define a name of disk and path. Note that
        each backslash in the path is doubled.




        In Windows, you can run the registry editor as follows:





        1. Start » Run... (or hit Win+R)

        2. Type: regedit

        3. In Windows Vista and above, UAC will pop up, click "Yes".






        share|improve this answer





















        • 5





          Nice to know, even though I don't use subst anymore. But back in the times when I did I used to simply have a batch file sitting in my Startup folder which did those things.

          – Joey
          Aug 25 '09 at 8:46






        • 2





          This is awesome. (It requires a reboot, FYI.) Our source tree has to start from a specific drive letter so that our PDBs all always align on different computers. This registry setting solves an annoyance that I have had for years with a subst disk not being there with runas which is a big annoyance if you need to (rarely) run Visual Studio under an admin account.

          – Brian Reiter
          Sep 23 '09 at 18:58






        • 3





          Joey: That solution doesn't seem to work under Windows 7. When running an application with Administrative privileges, the substituted drive is not visible to the application.

          – Dave Jarvis
          Jul 29 '12 at 19:06






        • 27





          Thanks for the solution. FYI, if you type the variable into RegEdit interactively, do not double the backslashes. That is, create a new string variable named "Z:" (without the quotes) and set the value to the string shown above except with single backslashes.

          – Crispy
          Aug 21 '12 at 20:58






        • 2





          @Devil'sAdvocate, ?? is a virtual directory in the NT object manager namespace. First it checks the logon session DOS 'devices' (really DOS devices are symbolic links to NT devices, usually located in Device) and then the Global?? DOS devices. In WinObj you'll find the logon session devices in SessionsDosDevices[logon ID]. Notice that logon session devices are all tracked in session 0 (services) for each LSA logon ID. They aren't correlated with desktop sessions. That's why if you map a drive as a limited admin it doesn't exist when elevated; it's a different logon.

          – eryksun
          Jul 20 '16 at 23:35














        139












        139








        139







        Well Wikipedia mentions:




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



        So you can associate paths with drive letters using subst. The Persistent SUBST command (psubst) software seems to be darn handy, and they provide a solution to run it from startup:



        https://code.google.com/p/psubst/#Inconstancy




        Inconstancy



        However restart of a system destroys a virtual disk. What to do? A
        disk can be created after startup. But what to do, when a disk is
        needed on early steps of a startup? For example, to run services?
        There is system feature to start a virtual disk from the system
        registry:



        REGEDIT4 

        [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerDOS Devices]
        "Z:"="\??\C:\Documents and Settings\All Users\Shared Documents"


        It is enough to create a text file with the extension .REG and run
        it. When the next starting up of a system, the virtual disk will be
        exist at logon. It needs to define a name of disk and path. Note that
        each backslash in the path is doubled.




        In Windows, you can run the registry editor as follows:





        1. Start » Run... (or hit Win+R)

        2. Type: regedit

        3. In Windows Vista and above, UAC will pop up, click "Yes".






        share|improve this answer















        Well Wikipedia mentions:




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



        So you can associate paths with drive letters using subst. The Persistent SUBST command (psubst) software seems to be darn handy, and they provide a solution to run it from startup:



        https://code.google.com/p/psubst/#Inconstancy




        Inconstancy



        However restart of a system destroys a virtual disk. What to do? A
        disk can be created after startup. But what to do, when a disk is
        needed on early steps of a startup? For example, to run services?
        There is system feature to start a virtual disk from the system
        registry:



        REGEDIT4 

        [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerDOS Devices]
        "Z:"="\??\C:\Documents and Settings\All Users\Shared Documents"


        It is enough to create a text file with the extension .REG and run
        it. When the next starting up of a system, the virtual disk will be
        exist at logon. It needs to define a name of disk and path. Note that
        each backslash in the path is doubled.




        In Windows, you can run the registry editor as follows:





        1. Start » Run... (or hit Win+R)

        2. Type: regedit

        3. In Windows Vista and above, UAC will pop up, click "Yes".







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jun 17 '13 at 22:03









        Sk8erPeter

        4852825




        4852825










        answered Aug 24 '09 at 23:04









        Ivo FlipseIvo Flipse

        21.8k2795145




        21.8k2795145








        • 5





          Nice to know, even though I don't use subst anymore. But back in the times when I did I used to simply have a batch file sitting in my Startup folder which did those things.

          – Joey
          Aug 25 '09 at 8:46






        • 2





          This is awesome. (It requires a reboot, FYI.) Our source tree has to start from a specific drive letter so that our PDBs all always align on different computers. This registry setting solves an annoyance that I have had for years with a subst disk not being there with runas which is a big annoyance if you need to (rarely) run Visual Studio under an admin account.

          – Brian Reiter
          Sep 23 '09 at 18:58






        • 3





          Joey: That solution doesn't seem to work under Windows 7. When running an application with Administrative privileges, the substituted drive is not visible to the application.

          – Dave Jarvis
          Jul 29 '12 at 19:06






        • 27





          Thanks for the solution. FYI, if you type the variable into RegEdit interactively, do not double the backslashes. That is, create a new string variable named "Z:" (without the quotes) and set the value to the string shown above except with single backslashes.

          – Crispy
          Aug 21 '12 at 20:58






        • 2





          @Devil'sAdvocate, ?? is a virtual directory in the NT object manager namespace. First it checks the logon session DOS 'devices' (really DOS devices are symbolic links to NT devices, usually located in Device) and then the Global?? DOS devices. In WinObj you'll find the logon session devices in SessionsDosDevices[logon ID]. Notice that logon session devices are all tracked in session 0 (services) for each LSA logon ID. They aren't correlated with desktop sessions. That's why if you map a drive as a limited admin it doesn't exist when elevated; it's a different logon.

          – eryksun
          Jul 20 '16 at 23:35














        • 5





          Nice to know, even though I don't use subst anymore. But back in the times when I did I used to simply have a batch file sitting in my Startup folder which did those things.

          – Joey
          Aug 25 '09 at 8:46






        • 2





          This is awesome. (It requires a reboot, FYI.) Our source tree has to start from a specific drive letter so that our PDBs all always align on different computers. This registry setting solves an annoyance that I have had for years with a subst disk not being there with runas which is a big annoyance if you need to (rarely) run Visual Studio under an admin account.

          – Brian Reiter
          Sep 23 '09 at 18:58






        • 3





          Joey: That solution doesn't seem to work under Windows 7. When running an application with Administrative privileges, the substituted drive is not visible to the application.

          – Dave Jarvis
          Jul 29 '12 at 19:06






        • 27





          Thanks for the solution. FYI, if you type the variable into RegEdit interactively, do not double the backslashes. That is, create a new string variable named "Z:" (without the quotes) and set the value to the string shown above except with single backslashes.

          – Crispy
          Aug 21 '12 at 20:58






        • 2





          @Devil'sAdvocate, ?? is a virtual directory in the NT object manager namespace. First it checks the logon session DOS 'devices' (really DOS devices are symbolic links to NT devices, usually located in Device) and then the Global?? DOS devices. In WinObj you'll find the logon session devices in SessionsDosDevices[logon ID]. Notice that logon session devices are all tracked in session 0 (services) for each LSA logon ID. They aren't correlated with desktop sessions. That's why if you map a drive as a limited admin it doesn't exist when elevated; it's a different logon.

          – eryksun
          Jul 20 '16 at 23:35








        5




        5





        Nice to know, even though I don't use subst anymore. But back in the times when I did I used to simply have a batch file sitting in my Startup folder which did those things.

        – Joey
        Aug 25 '09 at 8:46





        Nice to know, even though I don't use subst anymore. But back in the times when I did I used to simply have a batch file sitting in my Startup folder which did those things.

        – Joey
        Aug 25 '09 at 8:46




        2




        2





        This is awesome. (It requires a reboot, FYI.) Our source tree has to start from a specific drive letter so that our PDBs all always align on different computers. This registry setting solves an annoyance that I have had for years with a subst disk not being there with runas which is a big annoyance if you need to (rarely) run Visual Studio under an admin account.

        – Brian Reiter
        Sep 23 '09 at 18:58





        This is awesome. (It requires a reboot, FYI.) Our source tree has to start from a specific drive letter so that our PDBs all always align on different computers. This registry setting solves an annoyance that I have had for years with a subst disk not being there with runas which is a big annoyance if you need to (rarely) run Visual Studio under an admin account.

        – Brian Reiter
        Sep 23 '09 at 18:58




        3




        3





        Joey: That solution doesn't seem to work under Windows 7. When running an application with Administrative privileges, the substituted drive is not visible to the application.

        – Dave Jarvis
        Jul 29 '12 at 19:06





        Joey: That solution doesn't seem to work under Windows 7. When running an application with Administrative privileges, the substituted drive is not visible to the application.

        – Dave Jarvis
        Jul 29 '12 at 19:06




        27




        27





        Thanks for the solution. FYI, if you type the variable into RegEdit interactively, do not double the backslashes. That is, create a new string variable named "Z:" (without the quotes) and set the value to the string shown above except with single backslashes.

        – Crispy
        Aug 21 '12 at 20:58





        Thanks for the solution. FYI, if you type the variable into RegEdit interactively, do not double the backslashes. That is, create a new string variable named "Z:" (without the quotes) and set the value to the string shown above except with single backslashes.

        – Crispy
        Aug 21 '12 at 20:58




        2




        2





        @Devil'sAdvocate, ?? is a virtual directory in the NT object manager namespace. First it checks the logon session DOS 'devices' (really DOS devices are symbolic links to NT devices, usually located in Device) and then the Global?? DOS devices. In WinObj you'll find the logon session devices in SessionsDosDevices[logon ID]. Notice that logon session devices are all tracked in session 0 (services) for each LSA logon ID. They aren't correlated with desktop sessions. That's why if you map a drive as a limited admin it doesn't exist when elevated; it's a different logon.

        – eryksun
        Jul 20 '16 at 23:35





        @Devil'sAdvocate, ?? is a virtual directory in the NT object manager namespace. First it checks the logon session DOS 'devices' (really DOS devices are symbolic links to NT devices, usually located in Device) and then the Global?? DOS devices. In WinObj you'll find the logon session devices in SessionsDosDevices[logon ID]. Notice that logon session devices are all tracked in session 0 (services) for each LSA logon ID. They aren't correlated with desktop sessions. That's why if you map a drive as a limited admin it doesn't exist when elevated; it's a different logon.

        – eryksun
        Jul 20 '16 at 23:35













        72














        Installing it at HKEY_CURRENT_USER has the benefit of having different setups for each user. I prefer to stick the user space setup as long as a system service dose not depend on the device.



        REGEDIT4
        [HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionRun]
        "F Drive"="subst F: D:\mount\db"
        "G Drive"="subst G: D:\mount\log"


        Source: http://networkadminkb.com/KB/a446/how-to-use-drive-letters-mount-points-the-same-disk-drive.aspx






        share|improve this answer





















        • 5





          +1 For showing how to do multiple mappings in one reg file. :-)

          – megaflop
          May 15 '12 at 15:37






        • 4





          +1 for the ease of this & also explaining why HKEY_CURRENT_USER. :)

          – CAD bloke
          Feb 18 '13 at 8:19






        • 1





          +1 for showing a very elegant way to automagically do it without a batch in the startup folder

          – dkellner
          Aug 3 '15 at 13:34






        • 1





          Can also do this from the command line (since XP/Windows 2000 server): reg add HKCUSOFTWAREMicrosoftWindowsCurrentVersionRun /v "F Drive" /d "subst F: D:xdb" NB only needs escaping here if it is the last character of the subst command, e.g. when the target is the root directory: "subst F: D:\"; a single there would be interpreted as escaping the " following it.

          – stevek_mcc
          Oct 12 '16 at 10:50


















        72














        Installing it at HKEY_CURRENT_USER has the benefit of having different setups for each user. I prefer to stick the user space setup as long as a system service dose not depend on the device.



        REGEDIT4
        [HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionRun]
        "F Drive"="subst F: D:\mount\db"
        "G Drive"="subst G: D:\mount\log"


        Source: http://networkadminkb.com/KB/a446/how-to-use-drive-letters-mount-points-the-same-disk-drive.aspx






        share|improve this answer





















        • 5





          +1 For showing how to do multiple mappings in one reg file. :-)

          – megaflop
          May 15 '12 at 15:37






        • 4





          +1 for the ease of this & also explaining why HKEY_CURRENT_USER. :)

          – CAD bloke
          Feb 18 '13 at 8:19






        • 1





          +1 for showing a very elegant way to automagically do it without a batch in the startup folder

          – dkellner
          Aug 3 '15 at 13:34






        • 1





          Can also do this from the command line (since XP/Windows 2000 server): reg add HKCUSOFTWAREMicrosoftWindowsCurrentVersionRun /v "F Drive" /d "subst F: D:xdb" NB only needs escaping here if it is the last character of the subst command, e.g. when the target is the root directory: "subst F: D:\"; a single there would be interpreted as escaping the " following it.

          – stevek_mcc
          Oct 12 '16 at 10:50
















        72












        72








        72







        Installing it at HKEY_CURRENT_USER has the benefit of having different setups for each user. I prefer to stick the user space setup as long as a system service dose not depend on the device.



        REGEDIT4
        [HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionRun]
        "F Drive"="subst F: D:\mount\db"
        "G Drive"="subst G: D:\mount\log"


        Source: http://networkadminkb.com/KB/a446/how-to-use-drive-letters-mount-points-the-same-disk-drive.aspx






        share|improve this answer















        Installing it at HKEY_CURRENT_USER has the benefit of having different setups for each user. I prefer to stick the user space setup as long as a system service dose not depend on the device.



        REGEDIT4
        [HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionRun]
        "F Drive"="subst F: D:\mount\db"
        "G Drive"="subst G: D:\mount\log"


        Source: http://networkadminkb.com/KB/a446/how-to-use-drive-letters-mount-points-the-same-disk-drive.aspx







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Feb 24 '12 at 18:42









        Raystafarian

        19.4k104989




        19.4k104989










        answered Feb 24 '12 at 17:38









        166_MMX166_MMX

        83167




        83167








        • 5





          +1 For showing how to do multiple mappings in one reg file. :-)

          – megaflop
          May 15 '12 at 15:37






        • 4





          +1 for the ease of this & also explaining why HKEY_CURRENT_USER. :)

          – CAD bloke
          Feb 18 '13 at 8:19






        • 1





          +1 for showing a very elegant way to automagically do it without a batch in the startup folder

          – dkellner
          Aug 3 '15 at 13:34






        • 1





          Can also do this from the command line (since XP/Windows 2000 server): reg add HKCUSOFTWAREMicrosoftWindowsCurrentVersionRun /v "F Drive" /d "subst F: D:xdb" NB only needs escaping here if it is the last character of the subst command, e.g. when the target is the root directory: "subst F: D:\"; a single there would be interpreted as escaping the " following it.

          – stevek_mcc
          Oct 12 '16 at 10:50
















        • 5





          +1 For showing how to do multiple mappings in one reg file. :-)

          – megaflop
          May 15 '12 at 15:37






        • 4





          +1 for the ease of this & also explaining why HKEY_CURRENT_USER. :)

          – CAD bloke
          Feb 18 '13 at 8:19






        • 1





          +1 for showing a very elegant way to automagically do it without a batch in the startup folder

          – dkellner
          Aug 3 '15 at 13:34






        • 1





          Can also do this from the command line (since XP/Windows 2000 server): reg add HKCUSOFTWAREMicrosoftWindowsCurrentVersionRun /v "F Drive" /d "subst F: D:xdb" NB only needs escaping here if it is the last character of the subst command, e.g. when the target is the root directory: "subst F: D:\"; a single there would be interpreted as escaping the " following it.

          – stevek_mcc
          Oct 12 '16 at 10:50










        5




        5





        +1 For showing how to do multiple mappings in one reg file. :-)

        – megaflop
        May 15 '12 at 15:37





        +1 For showing how to do multiple mappings in one reg file. :-)

        – megaflop
        May 15 '12 at 15:37




        4




        4





        +1 for the ease of this & also explaining why HKEY_CURRENT_USER. :)

        – CAD bloke
        Feb 18 '13 at 8:19





        +1 for the ease of this & also explaining why HKEY_CURRENT_USER. :)

        – CAD bloke
        Feb 18 '13 at 8:19




        1




        1





        +1 for showing a very elegant way to automagically do it without a batch in the startup folder

        – dkellner
        Aug 3 '15 at 13:34





        +1 for showing a very elegant way to automagically do it without a batch in the startup folder

        – dkellner
        Aug 3 '15 at 13:34




        1




        1





        Can also do this from the command line (since XP/Windows 2000 server): reg add HKCUSOFTWAREMicrosoftWindowsCurrentVersionRun /v "F Drive" /d "subst F: D:xdb" NB only needs escaping here if it is the last character of the subst command, e.g. when the target is the root directory: "subst F: D:\"; a single there would be interpreted as escaping the " following it.

        – stevek_mcc
        Oct 12 '16 at 10:50







        Can also do this from the command line (since XP/Windows 2000 server): reg add HKCUSOFTWAREMicrosoftWindowsCurrentVersionRun /v "F Drive" /d "subst F: D:xdb" NB only needs escaping here if it is the last character of the subst command, e.g. when the target is the root directory: "subst F: D:\"; a single there would be interpreted as escaping the " following it.

        – stevek_mcc
        Oct 12 '16 at 10:50













        40














        There's an answer in the page you linked to. You don't need the third party tool, you can do it with a simple registry entry, as detailed on that page.



        Create a text file named 'mapdrive.reg' with these contents:



        REGEDIT4 

        [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerDOS Devices]
        "Z:"="\??\C:\Documents and Settings\All Users\Shared Documents"


        Then should just be able to double-click on it to set up, no 3rd party tools needed.






        share|improve this answer





















        • 6





          the advantage to the reg key versus the batch file is that it sets the subst drive before any other startup commands run, in case some of those need the subst drive to function

          – davr
          Aug 24 '09 at 23:37






        • 5





          @Ivo: I'd call it a healthy fear of the unknown ;)

          – Isxek
          Aug 24 '09 at 23:55






        • 6





          If doing this in regedit, make sure to use single backslashes. e.g. ??C:SomeDirectory

          – Droj
          Jul 28 '16 at 12:19
















        40














        There's an answer in the page you linked to. You don't need the third party tool, you can do it with a simple registry entry, as detailed on that page.



        Create a text file named 'mapdrive.reg' with these contents:



        REGEDIT4 

        [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerDOS Devices]
        "Z:"="\??\C:\Documents and Settings\All Users\Shared Documents"


        Then should just be able to double-click on it to set up, no 3rd party tools needed.






        share|improve this answer





















        • 6





          the advantage to the reg key versus the batch file is that it sets the subst drive before any other startup commands run, in case some of those need the subst drive to function

          – davr
          Aug 24 '09 at 23:37






        • 5





          @Ivo: I'd call it a healthy fear of the unknown ;)

          – Isxek
          Aug 24 '09 at 23:55






        • 6





          If doing this in regedit, make sure to use single backslashes. e.g. ??C:SomeDirectory

          – Droj
          Jul 28 '16 at 12:19














        40












        40








        40







        There's an answer in the page you linked to. You don't need the third party tool, you can do it with a simple registry entry, as detailed on that page.



        Create a text file named 'mapdrive.reg' with these contents:



        REGEDIT4 

        [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerDOS Devices]
        "Z:"="\??\C:\Documents and Settings\All Users\Shared Documents"


        Then should just be able to double-click on it to set up, no 3rd party tools needed.






        share|improve this answer















        There's an answer in the page you linked to. You don't need the third party tool, you can do it with a simple registry entry, as detailed on that page.



        Create a text file named 'mapdrive.reg' with these contents:



        REGEDIT4 

        [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerDOS Devices]
        "Z:"="\??\C:\Documents and Settings\All Users\Shared Documents"


        Then should just be able to double-click on it to set up, no 3rd party tools needed.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Dec 20 '18 at 1:08









        Vimes

        3411311




        3411311










        answered Aug 24 '09 at 23:08









        davrdavr

        3,85942944




        3,85942944








        • 6





          the advantage to the reg key versus the batch file is that it sets the subst drive before any other startup commands run, in case some of those need the subst drive to function

          – davr
          Aug 24 '09 at 23:37






        • 5





          @Ivo: I'd call it a healthy fear of the unknown ;)

          – Isxek
          Aug 24 '09 at 23:55






        • 6





          If doing this in regedit, make sure to use single backslashes. e.g. ??C:SomeDirectory

          – Droj
          Jul 28 '16 at 12:19














        • 6





          the advantage to the reg key versus the batch file is that it sets the subst drive before any other startup commands run, in case some of those need the subst drive to function

          – davr
          Aug 24 '09 at 23:37






        • 5





          @Ivo: I'd call it a healthy fear of the unknown ;)

          – Isxek
          Aug 24 '09 at 23:55






        • 6





          If doing this in regedit, make sure to use single backslashes. e.g. ??C:SomeDirectory

          – Droj
          Jul 28 '16 at 12:19








        6




        6





        the advantage to the reg key versus the batch file is that it sets the subst drive before any other startup commands run, in case some of those need the subst drive to function

        – davr
        Aug 24 '09 at 23:37





        the advantage to the reg key versus the batch file is that it sets the subst drive before any other startup commands run, in case some of those need the subst drive to function

        – davr
        Aug 24 '09 at 23:37




        5




        5





        @Ivo: I'd call it a healthy fear of the unknown ;)

        – Isxek
        Aug 24 '09 at 23:55





        @Ivo: I'd call it a healthy fear of the unknown ;)

        – Isxek
        Aug 24 '09 at 23:55




        6




        6





        If doing this in regedit, make sure to use single backslashes. e.g. ??C:SomeDirectory

        – Droj
        Jul 28 '16 at 12:19





        If doing this in regedit, make sure to use single backslashes. e.g. ??C:SomeDirectory

        – Droj
        Jul 28 '16 at 12:19











        21














        I found this because I was looking for an improvement over my startup subst scripts - they worked OK, but sometimes executed after folders crashed on startup because my drive wasn't yet mapped.



        First, I edited the registry, but was unable to get it to work. However, I did come across this alternative, which although it doesn't use subst does answer for me the question, "How to make SUBST mapping persistent across reboots?" Don't use subst... (insert appropriate 'computerName' and 'pathName'):



        net use u: "\computerNamec$pathName" /persistent:yes


        I adapted this from Hank Arnold's suggestion at this discussion of mapping local drives. I had guessed that \myComputerNamec might work, but I didn't know to apply the $.



        Before you try the "net use" command, try to navigate to


        \computerNamec$
        to make sure you have 'computerName' correct.




        share|improve this answer



















        • 2





          Excellent solution, albeit with two problems: 1) it's not visible to the local file-system, 2) permissions...

          – ashes999
          Oct 11 '11 at 15:41






        • 5





          if you use \localhostc$pathtothing it is portable across machines (or upgrades that change the computer name). A drawback of using a mapped drive on Win7+ is that different security policies apply to network drives than local, and some programs will just refuse to run off a mapped drive.

          – matt wilkie
          May 28 '13 at 6:55






        • 1





          It is visible to the file system, and it is visible to the local file system -- it's marked as a network drive, just as some drives are marked as removeable drives. That doesn't make such drives not a part of, or not visible to, the local file system -- it makes them network/removable drives in the local file system.

          – user165568
          Jan 2 '15 at 9:35






        • 1





          In testing I did for a performance issue (a couple of years back now) using the (locally) mounted network drive is also slower than using the file system (or subst etc.) directly. This is not a tremendous difference for small files or occasional use -- not like going over the actual network to another 'server' -- but it is significant.

          – HerbM
          Jan 8 '17 at 13:47
















        21














        I found this because I was looking for an improvement over my startup subst scripts - they worked OK, but sometimes executed after folders crashed on startup because my drive wasn't yet mapped.



        First, I edited the registry, but was unable to get it to work. However, I did come across this alternative, which although it doesn't use subst does answer for me the question, "How to make SUBST mapping persistent across reboots?" Don't use subst... (insert appropriate 'computerName' and 'pathName'):



        net use u: "\computerNamec$pathName" /persistent:yes


        I adapted this from Hank Arnold's suggestion at this discussion of mapping local drives. I had guessed that \myComputerNamec might work, but I didn't know to apply the $.



        Before you try the "net use" command, try to navigate to


        \computerNamec$
        to make sure you have 'computerName' correct.




        share|improve this answer



















        • 2





          Excellent solution, albeit with two problems: 1) it's not visible to the local file-system, 2) permissions...

          – ashes999
          Oct 11 '11 at 15:41






        • 5





          if you use \localhostc$pathtothing it is portable across machines (or upgrades that change the computer name). A drawback of using a mapped drive on Win7+ is that different security policies apply to network drives than local, and some programs will just refuse to run off a mapped drive.

          – matt wilkie
          May 28 '13 at 6:55






        • 1





          It is visible to the file system, and it is visible to the local file system -- it's marked as a network drive, just as some drives are marked as removeable drives. That doesn't make such drives not a part of, or not visible to, the local file system -- it makes them network/removable drives in the local file system.

          – user165568
          Jan 2 '15 at 9:35






        • 1





          In testing I did for a performance issue (a couple of years back now) using the (locally) mounted network drive is also slower than using the file system (or subst etc.) directly. This is not a tremendous difference for small files or occasional use -- not like going over the actual network to another 'server' -- but it is significant.

          – HerbM
          Jan 8 '17 at 13:47














        21












        21








        21







        I found this because I was looking for an improvement over my startup subst scripts - they worked OK, but sometimes executed after folders crashed on startup because my drive wasn't yet mapped.



        First, I edited the registry, but was unable to get it to work. However, I did come across this alternative, which although it doesn't use subst does answer for me the question, "How to make SUBST mapping persistent across reboots?" Don't use subst... (insert appropriate 'computerName' and 'pathName'):



        net use u: "\computerNamec$pathName" /persistent:yes


        I adapted this from Hank Arnold's suggestion at this discussion of mapping local drives. I had guessed that \myComputerNamec might work, but I didn't know to apply the $.



        Before you try the "net use" command, try to navigate to


        \computerNamec$
        to make sure you have 'computerName' correct.




        share|improve this answer













        I found this because I was looking for an improvement over my startup subst scripts - they worked OK, but sometimes executed after folders crashed on startup because my drive wasn't yet mapped.



        First, I edited the registry, but was unable to get it to work. However, I did come across this alternative, which although it doesn't use subst does answer for me the question, "How to make SUBST mapping persistent across reboots?" Don't use subst... (insert appropriate 'computerName' and 'pathName'):



        net use u: "\computerNamec$pathName" /persistent:yes


        I adapted this from Hank Arnold's suggestion at this discussion of mapping local drives. I had guessed that \myComputerNamec might work, but I didn't know to apply the $.



        Before you try the "net use" command, try to navigate to


        \computerNamec$
        to make sure you have 'computerName' correct.





        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 11 '11 at 23:34









        sagesage

        6041922




        6041922








        • 2





          Excellent solution, albeit with two problems: 1) it's not visible to the local file-system, 2) permissions...

          – ashes999
          Oct 11 '11 at 15:41






        • 5





          if you use \localhostc$pathtothing it is portable across machines (or upgrades that change the computer name). A drawback of using a mapped drive on Win7+ is that different security policies apply to network drives than local, and some programs will just refuse to run off a mapped drive.

          – matt wilkie
          May 28 '13 at 6:55






        • 1





          It is visible to the file system, and it is visible to the local file system -- it's marked as a network drive, just as some drives are marked as removeable drives. That doesn't make such drives not a part of, or not visible to, the local file system -- it makes them network/removable drives in the local file system.

          – user165568
          Jan 2 '15 at 9:35






        • 1





          In testing I did for a performance issue (a couple of years back now) using the (locally) mounted network drive is also slower than using the file system (or subst etc.) directly. This is not a tremendous difference for small files or occasional use -- not like going over the actual network to another 'server' -- but it is significant.

          – HerbM
          Jan 8 '17 at 13:47














        • 2





          Excellent solution, albeit with two problems: 1) it's not visible to the local file-system, 2) permissions...

          – ashes999
          Oct 11 '11 at 15:41






        • 5





          if you use \localhostc$pathtothing it is portable across machines (or upgrades that change the computer name). A drawback of using a mapped drive on Win7+ is that different security policies apply to network drives than local, and some programs will just refuse to run off a mapped drive.

          – matt wilkie
          May 28 '13 at 6:55






        • 1





          It is visible to the file system, and it is visible to the local file system -- it's marked as a network drive, just as some drives are marked as removeable drives. That doesn't make such drives not a part of, or not visible to, the local file system -- it makes them network/removable drives in the local file system.

          – user165568
          Jan 2 '15 at 9:35






        • 1





          In testing I did for a performance issue (a couple of years back now) using the (locally) mounted network drive is also slower than using the file system (or subst etc.) directly. This is not a tremendous difference for small files or occasional use -- not like going over the actual network to another 'server' -- but it is significant.

          – HerbM
          Jan 8 '17 at 13:47








        2




        2





        Excellent solution, albeit with two problems: 1) it's not visible to the local file-system, 2) permissions...

        – ashes999
        Oct 11 '11 at 15:41





        Excellent solution, albeit with two problems: 1) it's not visible to the local file-system, 2) permissions...

        – ashes999
        Oct 11 '11 at 15:41




        5




        5





        if you use \localhostc$pathtothing it is portable across machines (or upgrades that change the computer name). A drawback of using a mapped drive on Win7+ is that different security policies apply to network drives than local, and some programs will just refuse to run off a mapped drive.

        – matt wilkie
        May 28 '13 at 6:55





        if you use \localhostc$pathtothing it is portable across machines (or upgrades that change the computer name). A drawback of using a mapped drive on Win7+ is that different security policies apply to network drives than local, and some programs will just refuse to run off a mapped drive.

        – matt wilkie
        May 28 '13 at 6:55




        1




        1





        It is visible to the file system, and it is visible to the local file system -- it's marked as a network drive, just as some drives are marked as removeable drives. That doesn't make such drives not a part of, or not visible to, the local file system -- it makes them network/removable drives in the local file system.

        – user165568
        Jan 2 '15 at 9:35





        It is visible to the file system, and it is visible to the local file system -- it's marked as a network drive, just as some drives are marked as removeable drives. That doesn't make such drives not a part of, or not visible to, the local file system -- it makes them network/removable drives in the local file system.

        – user165568
        Jan 2 '15 at 9:35




        1




        1





        In testing I did for a performance issue (a couple of years back now) using the (locally) mounted network drive is also slower than using the file system (or subst etc.) directly. This is not a tremendous difference for small files or occasional use -- not like going over the actual network to another 'server' -- but it is significant.

        – HerbM
        Jan 8 '17 at 13:47





        In testing I did for a performance issue (a couple of years back now) using the (locally) mounted network drive is also slower than using the file system (or subst etc.) directly. This is not a tremendous difference for small files or occasional use -- not like going over the actual network to another 'server' -- but it is significant.

        – HerbM
        Jan 8 '17 at 13:47











        8














        Drop a batch file in your Startup folder that does all the SUBSTs that you want to do.






        share|improve this answer




























          8














          Drop a batch file in your Startup folder that does all the SUBSTs that you want to do.






          share|improve this answer


























            8












            8








            8







            Drop a batch file in your Startup folder that does all the SUBSTs that you want to do.






            share|improve this answer













            Drop a batch file in your Startup folder that does all the SUBSTs that you want to do.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Aug 24 '09 at 23:02









            EBGreenEBGreen

            7,5002235




            7,5002235























                5














                Since the original PSubst has some limitations and seems to be concluded by the author, I had to code a new version for my needs, fixing some problems and adding functionality and flexibility.



                Check here for PSubst version 3 batch file



                https://github.com/cyberponk/psubst



                Compatible with Windows 7, Windows 8, Windows 10, Windows Server 2012



                Note:
                This work has no intention of demeriting the original author and only came to existence because of real necessity, as follows:




                • As a newtork admin I have the constant need for SUBST´ing network drives and fiddling with different network users.


                • As not everyone is a Windows expert, i figured the automatic admin elevation with error handling would help, based on coments I read through the web.


                • As some people struggled with the arguments order, I figured it would be best for the script to work with arguments in any order.



                I can´t recall of every added functionality, but every inclusion was done purely by necessity. I am sharing the code so that others may not encounter the troubles I had. By this there is no intention other than sharing and helping.






                share|improve this answer


























                • Please, saying "A" say "B". You've siac that the original psubst has a lot of problem - please point on them if they are. On the other hand, psubst is not abandoned. It's just achieved the limit of its development. The original tool follows very simple philosophy: do something and do well. It is not overloaded with extra functionality like handling with UAC and creating additional vbs-code for doing something more. One thing can be done over the original code - some cosmetic changes to simplifing the code and improve readability.

                  – jsxt
                  Feb 29 '16 at 6:33











                • Editted, please review. UAC and vbs is for automatic admin elevation. I disagree on the "limit of development" comment, as all changes I made were to make the use even more simple and easy after I encountered several problems using PSUBST. I do not intend to criticise the original author, so I will not list problems, but instead I created solutions. I actually proposed to add my editions in the original github branch, but got refused, so I had to create my own branch.

                  – cyberponk
                  Mar 1 '16 at 16:56













                • Thank you for your fast and detailed feedback. Most probably I need have a look to your development closer.

                  – jsxt
                  Mar 1 '16 at 22:20











                • My hat's off to you; I've spent my time in the batch scripting trenches, and I know how painful it is. That code looks quite good.

                  – SilverbackNet
                  Jun 14 '17 at 19:01
















                5














                Since the original PSubst has some limitations and seems to be concluded by the author, I had to code a new version for my needs, fixing some problems and adding functionality and flexibility.



                Check here for PSubst version 3 batch file



                https://github.com/cyberponk/psubst



                Compatible with Windows 7, Windows 8, Windows 10, Windows Server 2012



                Note:
                This work has no intention of demeriting the original author and only came to existence because of real necessity, as follows:




                • As a newtork admin I have the constant need for SUBST´ing network drives and fiddling with different network users.


                • As not everyone is a Windows expert, i figured the automatic admin elevation with error handling would help, based on coments I read through the web.


                • As some people struggled with the arguments order, I figured it would be best for the script to work with arguments in any order.



                I can´t recall of every added functionality, but every inclusion was done purely by necessity. I am sharing the code so that others may not encounter the troubles I had. By this there is no intention other than sharing and helping.






                share|improve this answer


























                • Please, saying "A" say "B". You've siac that the original psubst has a lot of problem - please point on them if they are. On the other hand, psubst is not abandoned. It's just achieved the limit of its development. The original tool follows very simple philosophy: do something and do well. It is not overloaded with extra functionality like handling with UAC and creating additional vbs-code for doing something more. One thing can be done over the original code - some cosmetic changes to simplifing the code and improve readability.

                  – jsxt
                  Feb 29 '16 at 6:33











                • Editted, please review. UAC and vbs is for automatic admin elevation. I disagree on the "limit of development" comment, as all changes I made were to make the use even more simple and easy after I encountered several problems using PSUBST. I do not intend to criticise the original author, so I will not list problems, but instead I created solutions. I actually proposed to add my editions in the original github branch, but got refused, so I had to create my own branch.

                  – cyberponk
                  Mar 1 '16 at 16:56













                • Thank you for your fast and detailed feedback. Most probably I need have a look to your development closer.

                  – jsxt
                  Mar 1 '16 at 22:20











                • My hat's off to you; I've spent my time in the batch scripting trenches, and I know how painful it is. That code looks quite good.

                  – SilverbackNet
                  Jun 14 '17 at 19:01














                5












                5








                5







                Since the original PSubst has some limitations and seems to be concluded by the author, I had to code a new version for my needs, fixing some problems and adding functionality and flexibility.



                Check here for PSubst version 3 batch file



                https://github.com/cyberponk/psubst



                Compatible with Windows 7, Windows 8, Windows 10, Windows Server 2012



                Note:
                This work has no intention of demeriting the original author and only came to existence because of real necessity, as follows:




                • As a newtork admin I have the constant need for SUBST´ing network drives and fiddling with different network users.


                • As not everyone is a Windows expert, i figured the automatic admin elevation with error handling would help, based on coments I read through the web.


                • As some people struggled with the arguments order, I figured it would be best for the script to work with arguments in any order.



                I can´t recall of every added functionality, but every inclusion was done purely by necessity. I am sharing the code so that others may not encounter the troubles I had. By this there is no intention other than sharing and helping.






                share|improve this answer















                Since the original PSubst has some limitations and seems to be concluded by the author, I had to code a new version for my needs, fixing some problems and adding functionality and flexibility.



                Check here for PSubst version 3 batch file



                https://github.com/cyberponk/psubst



                Compatible with Windows 7, Windows 8, Windows 10, Windows Server 2012



                Note:
                This work has no intention of demeriting the original author and only came to existence because of real necessity, as follows:




                • As a newtork admin I have the constant need for SUBST´ing network drives and fiddling with different network users.


                • As not everyone is a Windows expert, i figured the automatic admin elevation with error handling would help, based on coments I read through the web.


                • As some people struggled with the arguments order, I figured it would be best for the script to work with arguments in any order.



                I can´t recall of every added functionality, but every inclusion was done purely by necessity. I am sharing the code so that others may not encounter the troubles I had. By this there is no intention other than sharing and helping.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 3 '16 at 17:54

























                answered Jun 11 '15 at 0:29









                cyberponkcyberponk

                15115




                15115













                • Please, saying "A" say "B". You've siac that the original psubst has a lot of problem - please point on them if they are. On the other hand, psubst is not abandoned. It's just achieved the limit of its development. The original tool follows very simple philosophy: do something and do well. It is not overloaded with extra functionality like handling with UAC and creating additional vbs-code for doing something more. One thing can be done over the original code - some cosmetic changes to simplifing the code and improve readability.

                  – jsxt
                  Feb 29 '16 at 6:33











                • Editted, please review. UAC and vbs is for automatic admin elevation. I disagree on the "limit of development" comment, as all changes I made were to make the use even more simple and easy after I encountered several problems using PSUBST. I do not intend to criticise the original author, so I will not list problems, but instead I created solutions. I actually proposed to add my editions in the original github branch, but got refused, so I had to create my own branch.

                  – cyberponk
                  Mar 1 '16 at 16:56













                • Thank you for your fast and detailed feedback. Most probably I need have a look to your development closer.

                  – jsxt
                  Mar 1 '16 at 22:20











                • My hat's off to you; I've spent my time in the batch scripting trenches, and I know how painful it is. That code looks quite good.

                  – SilverbackNet
                  Jun 14 '17 at 19:01



















                • Please, saying "A" say "B". You've siac that the original psubst has a lot of problem - please point on them if they are. On the other hand, psubst is not abandoned. It's just achieved the limit of its development. The original tool follows very simple philosophy: do something and do well. It is not overloaded with extra functionality like handling with UAC and creating additional vbs-code for doing something more. One thing can be done over the original code - some cosmetic changes to simplifing the code and improve readability.

                  – jsxt
                  Feb 29 '16 at 6:33











                • Editted, please review. UAC and vbs is for automatic admin elevation. I disagree on the "limit of development" comment, as all changes I made were to make the use even more simple and easy after I encountered several problems using PSUBST. I do not intend to criticise the original author, so I will not list problems, but instead I created solutions. I actually proposed to add my editions in the original github branch, but got refused, so I had to create my own branch.

                  – cyberponk
                  Mar 1 '16 at 16:56













                • Thank you for your fast and detailed feedback. Most probably I need have a look to your development closer.

                  – jsxt
                  Mar 1 '16 at 22:20











                • My hat's off to you; I've spent my time in the batch scripting trenches, and I know how painful it is. That code looks quite good.

                  – SilverbackNet
                  Jun 14 '17 at 19:01

















                Please, saying "A" say "B". You've siac that the original psubst has a lot of problem - please point on them if they are. On the other hand, psubst is not abandoned. It's just achieved the limit of its development. The original tool follows very simple philosophy: do something and do well. It is not overloaded with extra functionality like handling with UAC and creating additional vbs-code for doing something more. One thing can be done over the original code - some cosmetic changes to simplifing the code and improve readability.

                – jsxt
                Feb 29 '16 at 6:33





                Please, saying "A" say "B". You've siac that the original psubst has a lot of problem - please point on them if they are. On the other hand, psubst is not abandoned. It's just achieved the limit of its development. The original tool follows very simple philosophy: do something and do well. It is not overloaded with extra functionality like handling with UAC and creating additional vbs-code for doing something more. One thing can be done over the original code - some cosmetic changes to simplifing the code and improve readability.

                – jsxt
                Feb 29 '16 at 6:33













                Editted, please review. UAC and vbs is for automatic admin elevation. I disagree on the "limit of development" comment, as all changes I made were to make the use even more simple and easy after I encountered several problems using PSUBST. I do not intend to criticise the original author, so I will not list problems, but instead I created solutions. I actually proposed to add my editions in the original github branch, but got refused, so I had to create my own branch.

                – cyberponk
                Mar 1 '16 at 16:56







                Editted, please review. UAC and vbs is for automatic admin elevation. I disagree on the "limit of development" comment, as all changes I made were to make the use even more simple and easy after I encountered several problems using PSUBST. I do not intend to criticise the original author, so I will not list problems, but instead I created solutions. I actually proposed to add my editions in the original github branch, but got refused, so I had to create my own branch.

                – cyberponk
                Mar 1 '16 at 16:56















                Thank you for your fast and detailed feedback. Most probably I need have a look to your development closer.

                – jsxt
                Mar 1 '16 at 22:20





                Thank you for your fast and detailed feedback. Most probably I need have a look to your development closer.

                – jsxt
                Mar 1 '16 at 22:20













                My hat's off to you; I've spent my time in the batch scripting trenches, and I know how painful it is. That code looks quite good.

                – SilverbackNet
                Jun 14 '17 at 19:01





                My hat's off to you; I've spent my time in the batch scripting trenches, and I know how painful it is. That code looks quite good.

                – SilverbackNet
                Jun 14 '17 at 19:01











                2














                Actually, the PSUBST tool joins two different ways of creation of substituted drives in Windows. If you want to have persistent drives between startups then you can run this tool once per each drive that you need. Another way is to use the method suggested by "davr". the PSUBST tool just makes the same but allows to make it in the easier way.






                share|improve this answer




























                  2














                  Actually, the PSUBST tool joins two different ways of creation of substituted drives in Windows. If you want to have persistent drives between startups then you can run this tool once per each drive that you need. Another way is to use the method suggested by "davr". the PSUBST tool just makes the same but allows to make it in the easier way.






                  share|improve this answer


























                    2












                    2








                    2







                    Actually, the PSUBST tool joins two different ways of creation of substituted drives in Windows. If you want to have persistent drives between startups then you can run this tool once per each drive that you need. Another way is to use the method suggested by "davr". the PSUBST tool just makes the same but allows to make it in the easier way.






                    share|improve this answer













                    Actually, the PSUBST tool joins two different ways of creation of substituted drives in Windows. If you want to have persistent drives between startups then you can run this tool once per each drive that you need. Another way is to use the method suggested by "davr". the PSUBST tool just makes the same but allows to make it in the easier way.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Sep 23 '09 at 18:20







                    Ildar






























                        0














                        I like Visual Subst



                        Makes things easy






                        share|improve this answer




























                          0














                          I like Visual Subst



                          Makes things easy






                          share|improve this answer


























                            0












                            0








                            0







                            I like Visual Subst



                            Makes things easy






                            share|improve this answer













                            I like Visual Subst



                            Makes things easy







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Dec 14 '17 at 11:09









                            MikeyMikey

                            1,00021624




                            1,00021624






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Super User!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f29072%2fhow-to-make-subst-mapping-persistent-across-reboots%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                Сан-Квентин

                                Алькесар

                                Josef Freinademetz