Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows 可移动介质,可容纳D驱动器号_Windows_Powershell_Scripting - Fatal编程技术网

Windows 可移动介质,可容纳D驱动器号

Windows 可移动介质,可容纳D驱动器号,windows,powershell,scripting,Windows,Powershell,Scripting,我的系统上有一些SD卡或可移动媒体驱动器,默认情况下会使用D驱动器号 我有这个: PS C:\Windows\System32\WindowsPowerShell\v1.0> get-volume | where DriveType -Match "Removable" DriveLetter FileSystemLabel FileSystem DriveType HealthStatus SizeRemaining Size ----------- --------------- -

我的系统上有一些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
但我得到:

设置分区:传递给方法的一个或多个参数值无效。 第1行字符:50 + ... | 其中DriveType-匹配“Removable”|设置分区-NewDriveLetter G + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +CategoryInfo:InvalidArgument:(PS_-StorageCmdlet:ROOT/Microsoft/…_-StorageCmdlet)[设置分区], CimException +FullyQualifiedErrorId:MI结果4,设置分区

我怎样才能改变这个?或者是什么问题?我试图让磁盘通过,但也不起作用。
我可以在计算机管理gui中进行更改,但我需要命令行。

您应该可以用类似的东西来完成

$DriveLetter = (Get-Volume | Where-Object {$_.DriveType -eq "Removable"}).DriveLetter
Get-Partition -DriveLetter $DriveLetter | Set-Partition -NewDriveLetter G