LABEL - CMD


Overview

The LABEL command in Windows CMD is used to create, change, or delete the volume label of a disk. A volume label is a unique identifier for a storage device that is displayed in File Explorer and other Windows tools. This command can be used to organize or identify drives more easily without affecting the data stored on them.

Syntax

The basic syntax for the LABEL command is:

LABEL [drive:][label]
LABEL [/MP][volume] [label]
  • [drive:] specifies the drive letter of the disk whose label you want to create, change, or delete.
  • [label] is the new label for the disk. If no label is specified, the command will delete the current label.
  • /MP allows the label to be created or changed on a drive that is using a Mounted Point or a directory.

Options/Flags

  • /MP : This option is used to specify that the volume should be treated as a Mounted Point or volume name. This is useful when the disk does not have a traditional drive letter.

Examples

Example 1: Changing the Volume Label

To change the volume label of the E: drive to “BackupDrive”:

LABEL E: BackupDrive

Example 2: Deleting a Volume Label

To delete the volume label of the F: drive:

LABEL F:

Example 3: Using Mounted Points

To set the label of a volume mounted at C:\mnt\drive1 to “External”:

LABEL /MP C:\mnt\drive1 External

Common Issues

  • Access Denied: If you get an ‘Access Denied’ error, ensure you have administrative privileges to change the label of the drive.
  • Incorrect Drive Specified: Double-check the drive letter or mount point path if the system cannot find the drive.

Overcoming these issues generally involves running the Command Prompt as an administrator or verifying the path and drive letters.

Integration

LABEL can be integrated with other commands for scripting purposes, especially in automated backup systems, to help with drive identification. For instance, you can pair it with the ROBOCOPY command in a script to backup data to a drive identified by a specific label:

LABEL E: BackupDrive
ROBOCOPY C:\data E:\backup /MIR
  • DISKPART: A command-line utility that can also be used for managing and labeling disk partitions.
  • CHKDSK: Useful for checking the disk for errors before labeling it to avoid potential data loss on a faulty drive.

For more detailed information on using the LABEL command, you can consult the official Microsoft documentation available online, which provides further resources and advanced usage scenarios.