How to change drive letter from command prompt or powershell in windows

ReshmaA picture ReshmaA · Sep 23, 2015 · Viewed 29.7k times · Source

I wants to change my computer disk D:\ to E:\ from command prompt or powershell. Is there any way other than 'diskpart'?

Answer

nehcsivart picture nehcsivart · Sep 24, 2015

Assuming when you said "computer disk" you do not mean the System/Boot Disk, here is a solution using PowerShell. Note the variables. You can either replace them with the actual Drive Letters, or set them ahead of time.

Get-Partition -DriveLetter $old | Set-Partition -NewDriveLetter $new

Note here that $old and $new does not include the : character. So in your particular case (changing from D to E), you can use the following.

Get-Partition -DriveLetter D | Set-Partition -NewDriveLetter E

Note also that you will need Admin Rights. So run PowerShell as Admin.