Ever create a substituted drive in Windows before? If not, the SUBST command in Windows allows you to map a long file path to a drive letter.

For example, you could use this command to map the Outlook folder stored at C:\Documents and Settings\username\Local Settings\Application Data\Microsoft\Outlook to a drive letter like Z.

Table of Contents

    Whenever you click on the Z drive in My Computer, you would actually be redirected to the Outlook folder! This can be very useful in many different situations, especially when working with paths that are longer than 256 characters.

    So what’s the problem with using the SUBST command? It’s not persistent! That means when you restart the computer, your drive is gone. You have to create it again and you can’t have any startup program try to access the substituted drive since it’ll disappear.

    psubst is a nifty little program that you can use to create persistent substituted drive in Windows that will remain even after restarting.

    Creating a persistent virtual drive in Windows using psubst is very easy. First, download the ZIP archive and extract the .BAT file. You can extract files in Windows by simply right-clicking on the ZIP file and choosing Extract All.

    download psubst

    Go ahead and drop the psubst.bat file into your C:\Windows\System32 folder so that you can run it from anywhere at the command prompt.

    persistent substituted drive

    Once in place, go to the command prompt (Start, Run, CMD or just type CMD into the search box) and start creating virtual drives. The syntax for using psubst is as follows:

    Create a disk:

    psubst drive1: drive2:path

    Delete a disk:

    psubst drive1: /D

    List of existing disks:

    psubst

    This will use the standard subst command to create virtual drives. If you wan to create a persistent one, just the /P argument as shown:

    Create a persistent virtual drive:

    psubst drive1: drive2:path /P

    Delete a persistent virtual drive:

    psubst drive1: /D /P

    So to create a persistent virtual hard drive (Z) to the Outlook data folder I mentioned above, I would issue the following command:

    psubst z: "C:\Documents and Settings\akishore\Local Settings\Application Data\Microsoft\Outlook" /P

    psubst windows

    Now your new drive will show up as a local disk in My Computer:

    virtual drive windows

    Clicking on the disk will bring your directly into the Outlook folder. If you drop files or folders on the drive letter, the data will be copied to the folder.

    When you restart your computer, your drive will still be there. Not only that, but you can have other programs, such as services, etc, access the virtual drive even before Windows fully starts up because the drive will be available. It also shows up anywhere that Explorer is used like Open dialogs, Save as dialogs, etc.

    save as dialog

    Overall, mapping a folder to a drive letter is a great way to access a very deep folder quickly and easily. You can obviously also create a desktop shortcut to your folder, but the substituted drive method has the advantage of being accessible from any Windows dialog that lets you browse the computer. If you have a any questions, feel free to comment. Enjoy!

    Leave a Reply

    Your email address will not be published. Required fields are marked *