用 Remove-PartitionAccessPath 隐藏磁盘分区

去掉分区盘符,让它在资源管理器里消失但数据原封不动,不用碰 diskpart,恢复也简单。

Windows磁盘PowerShell分区高风险
以管理员身份执行 Get-Partition -DriveLetter D | Remove-PartitionAccessPath -AccessPath "D:\" 即可隐藏 D 盘;用 Add-PartitionAccessPath 加回盘符。

01命令

命令
$ Get-Partition -DriveLetter D | Remove-PartitionAccessPath -AccessPath "D:\"

02作用说明

盘符本质上只是一个访问路径,去掉它之后资源管理器和大部分程序就看不到这个分区,但里面的数据一个字节都不会动。这是隐藏备份盘、双系统的另一个系统分区这类"不想被误点"分区的干净做法,和 diskpart 的 remove letter 效果一样,但 PowerShell 的写法更直观、可配合管道。操作前先用 Get-Partition 记下磁盘号和分区号,恢复盘符时要用到。

03风险

风险高风险
使用条件Run PowerShell as administrator. Note the disk/partition numbers first with Get-Partition so you can restore the letter.
!注意: 绝对不要去掉 Windows 系统盘或正在被程序使用的分区的盘符。如果发现"盘不见了"先别慌,用 Add-PartitionAccessPath 把盘符加回来即可。

04撤销

撤销
$ Get-Partition -DiskNumber 1 -PartitionNumber 2 | Add-PartitionAccessPath -AssignDriveLetter

05来源

  • mountvol
    Microsoft Learn · vendor-doc · 2026-09-17
    依据: mountvol can list volume GUIDs and remove/add mount points — the command-line alternative for hiding and restoring drive letters.
  • Remove-PartitionAccessPath
    Microsoft Learn · vendor-doc · 2026-09-17
    依据: Remove-PartitionAccessPath removes a drive letter or mount point from a partition, making it inaccessible in Explorer while the data stays intact.

最后验证: 2026-09-18 · 分类: 文件与文件夹

06相关方案