SUBST

Posted On 2007-04-25 by FortyPoundHead
Keywords: Command Reference
Tags: Windows Commandline Windows
Views: 2592


Substitute a drive letter for a network or local path.  This comes in handy when you want to reference a directory which may have a really long path by a drive letter.

For example, instead of using 

c:\TopLevelFolder\NextLevelFolder\ThirdLevelFolder\AlmostThere\FinallyAtMyDestination

you could reference it by a drive letter, say, X:.  To do this, just use the command:

SUBS X: c:\TopLevelFolder\NextLevelFolder\ThirdLevelFolder\AlmostThere\FinallyAtMyDestination\

I've included the help file below for SUBST.  Hope this helps someone out there!

Syntax

SUBST drive_letter: path

SUBST 

SUBST drive_letter: /D

Key

SUBST with no parameters will display current SUBST drives

/D : Delete the drive_letter substitution.Compared to mapping a drive with NET USE the SUBST command allows mapping to a subfolder of a drive share - for the storage of user profiles this reduces the number of shares you need to create on the server.

Bugs

Under NT 4 SUBST''ed drives cannot be disconnected using the Explorer GUI - this was fixed in Windows 2000.

In Windows 2000 (and above) you will have problems creating, accessing and deleting drive mappings with SUBST. 

However under Win 2K/XP the functionality of the NET USE command is improved so you can now do 
NET USE g: \\server\share\folder1\folder2

If the network resource is unavailable (ie the server is down) SUBST will continually retry - unlike NET USE which will try to connect once and fail - depending on your application this may be a good or a bad thing - a subst drive that is not available will badly impact performance of most applications.

Notice that when SUBST is used against a local shared folder, it will create a RECYCLER for that drive. The RECYCLER is not removed when the drive substitution is removed, but can be deleted manually.


About the Author

has posted a total of 1974 articles.


Comments On This Post

No comments on this post yet!


Do you have a thought relating to this post? You can post your comment here. If you have an unrelated question, you can use the Q&A section to ask it.

Or you can drop a note to the administrators if you're not sure where you should post.


Your IP address is:54.166.141.12

Before you can post, you need to prove you are human. If you log in, this test goes away.


Code Links