Hide a Drive Letter with Remove-PartitionAccessPath

Remove a partition's drive letter so it disappears from File Explorer while all data stays intact — PowerShell instead of diskpart.

WindowsdiskpowershellpartitionsHigh risk
Run Get-Partition -DriveLetter D | Remove-PartitionAccessPath -AccessPath "D:\" in an admin PowerShell; bring it back with Add-PartitionAccessPath.

01Command

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

02What it does

A drive letter is just an access path — removing it hides the volume from File Explorer and most apps without touching a single byte of data. This is the clean way to tuck away a clutter partition, a backup drive, or a dual-boot's other system volume. The PowerShell cmdlets do the same job as diskpart's remove letter, but with clearer syntax and safe pipeline handling. Record the disk and partition numbers first (Get-Partition), because you'll need them to assign a letter again later.

03Risk

RiskHigh risk
RequirementsRun PowerShell as administrator. Note the disk/partition numbers first with Get-Partition so you can restore the letter.
!Warning: Never remove the letter from the Windows system drive or from a partition some program is actively using. If the wrong drive vanishes, restore the letter with Add-PartitionAccessPath before panicking about "lost" data.

04Undo

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

05Sources

  • mountvol
    Microsoft Learn · vendor-doc · 2026-09-17
    Evidence: 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
    Evidence: Remove-PartitionAccessPath removes a drive letter or mount point from a partition, making it inaccessible in Explorer while the data stays intact.

Last verified: 2026-09-18 · Category: Files & Folders

06Related solutions