Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am running a batch file that automatically maps a network drive on start up using the "net use" command:

net use d:\\server\share <mypassword> /user:<user>

This works fine as the result in explorer shows:

\\server\share (D:)

I would like to give the share a different name though, is there a way to provide some sort of alias in the net use command for the network mapped drive?

share|improve this question
Try this `subst i: d:` – Ankit Mishra Jan 6 '13 at 11:12
where does this fit in with the above net use command? – Dusty Roberts Jan 6 '13 at 11:13
Sorry it doesn't fit in net use command, but might help to use after it as a separate command. – Ankit Mishra Jan 6 '13 at 11:16
up vote 1 down vote accepted

I'm assuming that you want some sort of friendly label on the drive, so rather than saying "\\server\share," it says "Sales Reports" or whatever is in the share. Here's how you do it.

set driveUNC=\\server.domain.local\ShareName

REM Map the network drive.
net use * %driveUNC%

REM Alter the string a bit to come up with the registry key name.
set driveUNC=%driveUNC:\=#%

REM Change the drive's label in the registry.
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\%driveUNC%" /v  "_LabelFromDesktopINI" /t REG_SZ /d "Drive Label Goes Here" /f
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .