Share via


attributes volume

適用於:Windows Server 2022、Windows Server 2019、Windows Server 2016、Windows Server 2012 R2、Windows Server 2012

顯示、設定或清除磁碟區的屬性。

語法

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

參數

參數 描述
set 設定具有焦點之磁碟區的指定屬性。
clear 清除具有焦點之磁碟區的指定屬性。
readonly 指定磁碟區為唯讀。
隱藏 指定磁碟區為隱藏。
nodefaultdriveletter 指定磁碟區預設不會有磁碟機代號。
shadowcopy 指定磁碟區是陰影複本磁碟區。
noerr 僅適用於指令碼。 發生錯誤時,DiskPart 會繼續處理命令,就像沒有發生錯誤一樣。 如果沒有此參數,錯誤會導致 DiskPart 結束並出現錯誤碼。

備註

  • 在基本主要開機記錄 (MBR) 磁碟上,隱藏唯讀nodefaultdriveletter 參數會套用至磁碟上的所有磁碟區。

  • 在基本 GUID 分割區資料表 (GPT) 磁碟上,以及動態 MBR 和 gpt 磁碟上,隱藏唯讀nodefaultdriveletter 參數僅適用於選取的磁碟區。

  • 必須選擇磁碟區才能成功執行 attributes volume 命令。 使用 select volume 命令來選取磁碟區,並將焦點移至該磁碟區。

範例

若要在選取的磁碟區上顯示目前的屬性,請輸入:

attributes volume

若要將選取的磁碟區設定為隱藏及唯讀,請輸入:

attributes volume set hidden readonly

若要移除所選磁碟區上的隱藏及唯讀屬性,請輸入:

attributes volume clear hidden readonly