Programming Field

Label - DOS/Command Prompt Reference

Changes the volume label of a disk.

Syntax

label[.exe] [/MP] [<disk>] [<new-label>]
/MP

[Windows NT series] The presence of the string <disk> may indicate the location of a mount point. Using /MP and specifying a mount point with `` changes the volume label of the disk from which it is mounted. If `/MP` is not specified, the value specified as <disk>, which should be a mount point, is split before and after the colon (‘:’), and the string after the colon becomes the volume label. (Refer to Mountvol for information about mount points.)

If you specify /MP and omit <disk>, the volume label will be changed with the current directory as the mount point. If the current directory is not a mount point, it will display ‘Invalid drive specification’.

<disk>

Specifies the drive to change the volume label. The format will be ‘x:’ (where x is the drive letter) without including a backslash (‘\’).

If omitted, the current drive will be used (if /MP is specified and the current directory is the mount point, it will use the corresponding drive).

[Windows NT series] <disk> can be specified as the ‘volume name’ (you can determine the volume name using tools like Mountvol). Additionally, when /MP is specified, you can specify a directory that serves as the mount point for a particular disk. However, you must specify the directory using an absolute path. Also, since double quotation marks (‘"’) cannot be used, if the mount point directory contains spaces, you must use a short file name.

<new-label> Sets the new volume label. If omitted, a prompt will be displayed to input. Note that when specifying a volume label that includes spaces, you cannot use double quotation marks (‘"’). Therefore, you must specify <disk> without omitting it, and specify the volume label with spaces without adding double quotation marks at the end.

Details

Usage of Label

The Label program is different from other commands in that double quotation marks (‘"’) cannot be used. If used, depending on the type of disk, it may display ‘Invalid characters are included’, or the double quotation marks may be set as part of the volume label.

If the file system is FAT or FAT32, the following characters cannot be used (they can be used in the case of NTFS). Space characters are allowed.

* ? / \ | . , ; : + = [ ] < > "

The maximum number of characters for a volume label is 11 bytes (not 11 characters) for FAT/FAT32 and 32 characters (not 32 bytes) for NTFS.

Samples

Sample 1

label

A message like the following will be displayed (assuming the current drive is C, and the file system is NTFS; the volume serial number is omitted).

Volume in drive C: has no label
Volume Serial Number is xxxx-xxxx
Volume label (32 characters, ENTER for none)?

In the last prompt, you can input any volume label. If you want to set an empty volume label, simply press Enter. (If a non-empty volume label is already set, you will be asked, ‘Delete current volume label?’)

Sample 2

label D:

The above message will be displayed for the D drive.

Sample 3

label MyDisk

Sets the volume label of the current drive to ‘MyDisk’.

Sample 4

label Backup Disk

Sets the volume label of the current drive to ‘Backup Disk’. This syntax is considered as if <disk> is omitted, and it does not imply that <disk> means ‘Backup’.

Sample 5

label G: User Drive

Sets the volume label of the G drive to ‘User Drive’.

Sample 6

label /MP Hard Disk

[Windows NT series] If the current directory is a mount point, changes the volume label of the disk from which it is mounted to ‘Hard Disk’. If it is not a mount point, it will display ‘Invalid drive specification’.

Sample 7

label /MP C:\MyDir

[Windows NT series] If C:\MyDir is a mount point, a message prompting for the input of a new volume label for the source disk (similar to Sample 1) will be displayed.

If the mount point contains spaces, such as ‘C:\Documents and Settings\user\MyDir’, you need to use a short file name (e.g. ‘C:\DOCUME~1\USER\MYDIR’).

Sample 8

label \\?\Volume{00000000-1111-2222-3344-5566778899aa} Test Disk

[Windows NT series] If ‘\\?\Volume{00000000-1111-2222-3344-5566778899aa}’ is a valid volume name, changes the volume label of that disk to ‘Test Disk’.