LABEL

Edit a disk label.

Syntax
      LABEL [/MP][volume] [drive:] [label]

Key
   Drive:  The drive letter of the disk to be named.

   label   The new name for the volume.

   /MP     Treat the volume as a mount point or volume name.

   volume  The drive letter, mount point, or volume_name.
           If a volume_name is specified, the /MP parameter is unnecessary.

   /?      Display help. 

Originally designed as a reminder of which floppy disk is in the machine, disk labels can also be applied to hard drives and mapped drives. The label is shown in Windows File Explorer and most Save As dialogue boxes.

Changing the disk label with LABEL requires elevated permissions. Running the LABEL command from a non-elevated command prompt will generate the error. “Access Denied as you do not have sufficient privileges.
By default the SYSTEM account should have full access to the drive (root folder).

If you do not specify a label when you use the label command, LABEL will prompt for one and display a message including the "Volume Serial Number" if one exists.

A volume label can contain as many as 32 characters for NTFS volumes and as many as 11 characters for FAT volumes and can include spaces but not tabs.

FAT volume labels are not case sensitive and cannot contain any of the following characters: * ? / \ | . , ; : + = [ ] < > " This limitation does not apply to NTFS volume labels, however to use a redirection character in a disk label, the label must be enclosed in double quotes (which then become part of the label).

Early versions of Windows held the drive description in the registry at \CurrentVersion\Explorer\DriveIcons [x]

Examples

To label the disk drive D: as SS64:

C:\> label d: SS64

The drive description can also be modified with a few lines of PowerShell, this does not require elevation for (per-user) mapped drives:

# Rename drive G: to 'Groups'
$objshell = New-Object -ComObject "Shell.Application"
$mapDrive = "G:"
$objshell.NameSpace($mapDrive).Self.Name = "Groups"

Similarly in VBScript:

Set objshell = CreateObject ("Shell.Application")
mapDrive = "G:"
objshell.NameSpace(mapDrive).Self.Name = "Groups"

“A name is a label, and as soon as there is a label, the ideas disappear and out comes label-worship and label-bashing” ~ Richard Bach

Related commands

VOL - Display the volume label.
Equivalent PowerShell: gcim win32_logicaldisk "volumeName"
Equivalent bash command (Linux): hostname - Print or set system name.


 
Copyright © 1999-2024 SS64.com
Some rights reserved