如果您坐在命令提示符下并需要挂载ISO,请运行以下命令:
PowerShell Mount-DiskImage
这将调用PowerShell cmdlet。系统将提示您输入要挂载的ISO的路径。完成后,将最后一个留空,然后按Enter。
多田 它已安装:
要从PowerShell卸载ISO,请运行Dismount-DiskImage
并按照提示进行操作。如果您只知道硬盘驱动器号不在您的头顶,而您不知道映像路径,请使用以下命令:
Get-Volume [Drive Letter] | Get-DiskImage | Dismount-DiskImage
此命令将获取您指定的驱动器,找到磁盘映像,然后将其卸除。
您还可以使用该-PassThru
标志来存储传递给命令的数据。让我们装入一些ISO,显示其驱动器号,在其中一个驱动器上执行文件,然后卸除所有ISO。
挂载ISO
$MountedISOs=Mount-DiskImage -PassThru D:\Downloads\Ubuntu.iso,D:\Downloads\Windows8.iso,D:\Downloads\Server2012.iso
显示使用foreach
循环安装的每个ISO的音量信息
foreach($iso in $MountedISOs){Get-Volume -DiskImage $iso}
列出J驱动器
ls J:\
开启档案
start wubi.exe
要卸载ISO,请使用以下命令:
Dismount-DiskImage $MountedISOs.ImagePath
To build a simple script that checks if the ISO is attached and is in fact an ISO (vs. a VHD) I like to use -PassThru
to store the object temporarily, and use the Get-DiskImage
command to update the status of the DiskImage object. This will update the Attached
property. The StorageType
property will tell you whether the file is an ISO or VHD according to its file extension.
The StorageType
of a VHD is 2, where an ISO will return 1. Here's the output of $UbuntuISO
:
This is the output of $temp
after mounting a VHD: (Mount-DiskImage
can also mount VHDs!)
Note that the Attached
property above is False
, despite the Mount-DiskImage
command running without a hitch.
Keep in mind that the $UbuntuISO
variable will not stay updated either:
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句