Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 646
ReshmaA Avatar asked Mar 14 '23 16:03

ReshmaA


1 Answers

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.

like image 149
nehcsivart Avatar answered Apr 28 '23 07:04

nehcsivart