Removes a drive letter or mount point from a volume.
For examples of how this command can be used, see Examples.
Syntax
remove [{letter=<d> | mount=<path> | all}] [dismount] [noerr]
Parameters
Parameter | Description |
---|---|
letter=<d> |
The drive letter to be removed. |
mount=<path> |
The mount point path to be removed. |
all |
Removes all current drive letters and mount points. |
dismount |
Dismounts the basic volume, when all drive letters and mount points have been removed from the volume, and takes the basic volume offline, making it unmountable. If other processes are using the volume, DiskPart closes any open handles (files in use by an application) before dismounting the volume. You can make the volume mountable again by assigning it a driver letter or by creating a mount point path to the volume. Dismount will fail if used on a volume that has any remaining drive letters or mount points. For scripting, using remove all dismount is recommended. |
noerr |
For scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without this parameter, an error causes DiskPart to exit with an error code. |
Remarks
- If no drive letter or mount point is specified, DiskPart
removes the first drive letter or mount point it encounters.
- This command can be used to change the drive letter associated
with a removable drive.
- You cannot remove the drive letter on a system, boot, or paging
volume. In addition, you cannot remove the drive letter for an OEM
partition, any GPT partition with an unrecognized GUID, or any of
the special, non-data, GPT partitions such as the EFI system
partition.
Examples
To remove the drive letter from drive K, type:
remove letter=k
To remove all current drive letters and mount points, and dismount the volumes, type:
remove all dismount