Windows – how to change mapped drive label from command line

batch-filecommand-line-interfacewindows

How might one control the label for mapped drives as they appear in My Computer, from the command line?

The goal is to have the drive letter at the beginning of the phrase instead of the end, so when navigating with the keyboard one simply types the drive letter to jump to that item in the list. So, for example:

net use x: \\servername\skunkworks

will show this in My Computer:

skunkworks on 'Long descriptive name of file server (servername)' (X:)

but what we want is something like:

X: Skunkworks on Servername

One can interactively change the label with Windows Explorer, but this must be done seperately for every user profile and is a pain. It'd be really nice to relabel the drives as part of the login script.

Best Answer

You can actually change this per drive mapping with a name of your choice. We do this if customers want to give more friendly names to mapped drives in enterprise environents.

Check out the following vbscript to get you in the right direction (a better script would take path an desired name as arguments and do drive mappings in a function for a bit more streamlined and object-oriented approach)

http://www.computerperformance.co.uk/ezine/ezine60.htm