Kernel32SetVolumeLabel Method

Sets the label of a file system volume.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("Kernel32.dll", CharSet = CharSet.Auto, BestFitMapping = false, 
	ThrowOnUnmappableChar = true, SetLastError = true)]
public static bool SetVolumeLabel(
	string rootPathName,
	string volumeName
)

Parameters

rootPathName  String
A pointer to a string that contains the volume's drive letter (for example, X:) or the path of a mounted folder that is associated with the volume (for example, Y:\MountX).

The string must end with a trailing backslash ('').

If this parameter is , the root of the current directory is used.

volumeName  String
A pointer to a string that contains the new label for the volume.

If this parameter is , the function deletes any existing label from the specified volume and does not assign a new label.

Return Value

Boolean
If the function succeeds, the return value is .

If the function fails, the return value is .

To get extended error information, call GetLastWin32Error.

Remarks

See Also