简体   繁体   English

如何在Windows中从命令提示符或powershell更改驱动器号

[英]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. 我想从命令提示符或powershell将我的计算机磁盘D:\\更改为E:\\。 Is there any way other than 'diskpart'? 除了'diskpart'之外还有什么方法吗?

Assuming when you said "computer disk" you do not mean the System/Boot Disk, here is a solution using PowerShell. 假设您说“计算机磁盘” 并不意味着系统/启动盘,这是使用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. 这里注意, $old$new 包括:字符。 So in your particular case (changing from D to E), you can use the following. 因此,在您的特定情况下(从D更改为E),您可以使用以下内容。

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

Note also that you will need Admin Rights. 另请注意,您需要管理员权限。 So run PowerShell as Admin. 因此,以管理员身份运行PowerShell。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM