隱藏 [我的電腦] 中這些指定的磁碟機 的登錄值 NoDrives使用者HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer

原則 ID
NoDrives
適用範圍
使用者設定
支援的作業系統
至少需要 Windows 2000
來源
Administrative Templates (.admx) for Windows 11 2026 Update (26H2) (版本 1.0)
類別
Windows 元件 › 檔案總管

登錄

NoDrives

REG_DWORD使用者
啟用時的值
取決於選項值
元素
選擇下列組合的其中一個
選項
項目儲存的值
只限制 A 和 B 磁碟3
只限制 C 磁碟4
只限制 D 磁碟8
只限制 A、B 和 C 磁碟7
只限制 A、B、C 和 D 磁碟15
限制所有磁碟67108863
不限制磁碟0
以 .reg · CMD · PowerShell 套用
.reg
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer]

; 選項 (只使用其中一個)
; 只限制 A 和 B 磁碟
"NoDrives"=dword:00000003
; 只限制 C 磁碟
"NoDrives"=dword:00000004
; 只限制 D 磁碟
"NoDrives"=dword:00000008
; 只限制 A、B 和 C 磁碟
"NoDrives"=dword:00000007
; 只限制 A、B、C 和 D 磁碟
"NoDrives"=dword:0000000f
; 限制所有磁碟
"NoDrives"=dword:03ffffff
; 不限制磁碟
"NoDrives"=dword:00000000
CMD
:: 選項 (只使用其中一個)

:: 只限制 A 和 B 磁碟
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoDrives" /t REG_DWORD /d 3 /f
:: 只限制 C 磁碟
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoDrives" /t REG_DWORD /d 4 /f
:: 只限制 D 磁碟
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoDrives" /t REG_DWORD /d 8 /f
:: 只限制 A、B 和 C 磁碟
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoDrives" /t REG_DWORD /d 7 /f
:: 只限制 A、B、C 和 D 磁碟
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoDrives" /t REG_DWORD /d 15 /f
:: 限制所有磁碟
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoDrives" /t REG_DWORD /d 67108863 /f
:: 不限制磁碟
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoDrives" /t REG_DWORD /d 0 /f
PowerShell
# 共通: 建立機碼
New-Item -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Force | Out-Null

# 選項 (只使用其中一個)
# 只限制 A 和 B 磁碟
New-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Name 'NoDrives' -PropertyType DWord -Value 3 -Force | Out-Null
# 只限制 C 磁碟
New-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Name 'NoDrives' -PropertyType DWord -Value 4 -Force | Out-Null
# 只限制 D 磁碟
New-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Name 'NoDrives' -PropertyType DWord -Value 8 -Force | Out-Null
# 只限制 A、B 和 C 磁碟
New-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Name 'NoDrives' -PropertyType DWord -Value 7 -Force | Out-Null
# 只限制 A、B、C 和 D 磁碟
New-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Name 'NoDrives' -PropertyType DWord -Value 15 -Force | Out-Null
# 限制所有磁碟
New-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Name 'NoDrives' -PropertyType DWord -Value 67108863 -Force | Out-Null
# 不限制磁碟
New-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Name 'NoDrives' -PropertyType DWord -Value 0 -Force | Out-Null