可移动媒体保存D驱动器号

我的系统上有一些SD卡或可移动介质驱动器,默认情况下会带D驱动器号。

我有这个:

PS C:\Windows\System32\WindowsPowerShell\v1.0> get-volume | where DriveType -Match "removable"

DriveLetter FileSystemLabel FileSystem DriveType HealthStatus SizeRemaining Size
----------- --------------- ---------- --------- ------------ ------------- ----
E                                      removable Healthy                0 B  0 B

我想这样将其更改为G:

PS C:\Windows\System32\WindowsPowerShell\v1.0> get-volume | where DriveType -Match "removable" |Set-Partition -NewDriveLetter G

但是我得到:

  

Set-Partition:一个或多个传递给该方法的参数值无效。       在线:1个字符:50个       + ... |其中DriveType-匹配“可移动” |设置分区-NewDriveLetter G       + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~           + CategoryInfo:InvalidArgument:(PS_StorageCmdlets:ROOT / microsoft /..._ StorageCmdlets)[Set-Partition],          CimException           + FullyQualifiedErrorId:MI RESULT 4,设置分区

我该如何更改?或者是什么问题?我尝试使用get-disk通过,但也不起作用。 我可以在计算机管理GUI中进行更改,但需要命令行。

vfshangjitiku 回答:可移动媒体保存D驱动器号

您应该可以使用类似的方法做到这一点。

$DriveLetter = (Get-Volume | Where-Object {$_.DriveType -eq "Removable"}).DriveLetter
Get-Partition -DriveLetter $DriveLetter | Set-Partition -NewDriveLetter G
本文链接:https://www.f2er.com/3146812.html

大家都在问