attributes volume

显示、设置或清除卷的属性。

Syntax

attributes volume [{set | clear}] [{hidden | readonly | nodefaultdriveletter | shadowcopy}] [noerr]

Parameters

Parameter Description
set 设置带焦点的卷的指定属性。
清楚 清除带焦点的卷的指定属性。
readonly 指定该卷为只读状态。
隐藏 指定该卷为隐藏状态。
nodefaultdriveletter 指定该卷在默认情况下不会接收驱动器号。
shadowcopy 指定该卷是一个卷影副本卷。
noerr 仅用于脚本。 出现错误时,DiskPart 继续处理命令,就像未发生错误一样。 如果没有此参数,则错误会导致 DiskPart 退出并显示错误代码。

Remarks

  • On basic master boot record (MBR) disks, the hidden, readonly, and nodefaultdriveletter parameters apply to all volumes on the disk.

  • On basic GUID partition table (GPT) disks, and on dynamic MBR and gpt disks, the hidden, readonly, and nodefaultdriveletter parameters apply only to the selected volume.

  • A volume must be selected for the attributes volume command to succeed. Use the select volume command to select a volume and shift the focus to it.

Examples

若要显示所选卷的当前属性,请键入:

attributes volume

若要将所选卷设置为隐藏和只读,请键入:

attributes volume set hidden readonly

若要删除所选卷上的隐藏和只读属性,请键入:

attributes volume clear hidden readonly