Change network drive label by command line
30,636
Solution 1
The label command will only work for a physical drive. To rename a mapped network drive, you need to rename it using My Computer on a machine. To automate this for use across many computers, the new label will be saved as a registry key. Look for the following key:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2
Export the "_LabelFromReg" key for the drive in question and import the key on the other machines before your "net use" command.
Solution 2
Another perhaps slightly faster method is using Powershell:
$a = New-Object -ComObject shell.application
$a.NameSpace( "X:\" ).self.name = "YOURLABEL"
Related videos on Youtube
Author by
Adewale Oluyinka
Updated on September 17, 2022Comments
-
Adewale Oluyinka over 1 year
I have just create a new network driver by command line using
net use
But when I try to change this drive's label by command line using
label
command, an error occurs:C:\>label X: Shared Parameters not compatible.
How can I change this by command line?
-
Admin over 7 yearsTry this solution: superuser.com/a/795473/248359 it works great
-
-
Friedrich Philipp over 6 yearsWhat "_LabelFromReg" key are you talking about? What do I have to write into MountPoints2?
-
Finiox almost 6 yearsDoesn't seem to work? Give me an error that
name
cannot be found on this object -
Admin almost 2 yearsNo errors, but has no effect, the label does not change.