Windows 10 有一个出色的工具来管理您的驱动器和分区,称为磁盘管理(Disk Management)。它的最佳功能之一是它允许您挂载和卸载VHD文件,以便您可以根据需要使用它们。在本指南中,我们将向您展示如何在Windows 10(Windows 10)中附加和分离虚拟硬盘(Virtual Hard Disk)( VHD ) 映像,以及如何永久附加始终可用的VHD文件。如果我们引起了您的兴趣,请继续阅读:
VHD(虚拟硬盘(Virtual Hard Disk))有什么用?
虚拟硬盘(Virtual Hard Disk)或VHD文件是一种虚拟硬盘驱动器映像,它将硬盘分区或文件系统中的所有数据存储在一个文件中。VHD文件通常由VirtualBox或 Microsoft 的虚拟化解决方案Hyper-V 等虚拟机软件创建和使用。此外, (Hyper-V. Additionally)Windows 7中的旧Windows 备份(Windows Backup)工具(仍存在于Windows 10中)还将系统映像保存为VHD文件。
如何打开VHD文件?(或如何使用磁盘管理挂载(Disk Management)VHD映像)
首先,在您的 Windows 10 PC 上打开计算机管理(open the Computer Management)控制台。在其中,选择左侧的磁盘管理。(Disk Management)
(Disk Management)计算机管理(Computer Management)中的磁盘管理
在同一左侧面板上,右键单击或按住磁盘管理(Disk Management),然后选择“附加 VHD”(“Attach VHD”)选项。
在磁盘管理中附加 VHD
您还可以在“磁盘管理”的(Disk Management)“操作”(Action)菜单中找到“附加 VHD”(“Attach VHD”)选项,如下面的屏幕截图所示。
(Attach VHD)在“磁盘管理”的“(Disk Management)操作(Actions)”菜单中附加 VHD
然后,磁盘管理会加载一个名为(Disk Management)“附加虚拟硬盘”(“Attach Virtual Hard Disk.”)的对话窗口。键入要装载的VHD文件的路径,或单击/点击(VHD)浏览(Browse)以在 Windows 10 PC 上找到它。
附加虚拟硬盘
找到要挂载的VHD文件并选择它。然后按打开(Open)按钮。
浏览虚拟磁盘(Browse Virtual Disk)文件并选择要挂载的文件
您现在回到“附加虚拟硬盘”(“Attach Virtual Hard Disk”)窗口。我们的建议是取消选中“只读”(“Read-only”)框,以便您可以修改在VHD映像中找到的文件。如果选中此框,则可以从VHD打开和复制文件,但不能以任何方式更改它们。单击(Click)或点击确定(OK)以打开 VHD 图像。
附加虚拟硬盘文件
您现在应该看到VHD文件已作为单独的磁盘驱动器装载,并且分配了自己的驱动器号。
在我们的例子中,装载的VHD映像包括(VHD)Windows 10系统驱动器上的三个不同分区。自然,只有安装了Windows 10(Windows 10)的分区才有驱动器号 – I – 正如您在下面的屏幕截图中所见。
VHD 文件已挂载
打开文件资源管理器(File Explorer)并单击新分区将其打开。
文件资源管理器中显示的(File Explorer)VHD文件的分区
现在,您可以轻松地从附加的VHD(VHD)文件中操作所需的文件。
浏览 VHD 文件
如何永久附加 VHD?
如果您的问题是“我如何(How)永久附加VHD?”,您应该这样做:
打开任务计划程序(Open the Task Scheduler),然后单击或点击“操作(Actions)”面板中的“创建任务”。(Create Task)(Create Task)
如何永久附加VHD:在任务计划程序中(Task Scheduler)创建任务(Create Task)
在“创建任务(Create Task)”窗口的“常规(General)”选项卡中,键入VHD永久装载任务的名称。然后,选择“无论用户是否登录都运行”(“Run whether user is logged on or not”)和“以最高权限运行”(“Run with highest privileges”)选项,然后在“配置为”(“Configure for”)下拉列表中选择Windows 10 。
如何永久附加 VHD:任务的常规设置
在“触发器(Triggers)”选项卡中,单击或点击“新建”(New)。
如何永久附加 VHD:任务的触发器
这将打开新触发器(New Trigger)窗口。在其中,从顶部的“开始任务”列表中选择(“Begin the task”)“启动时” 。(“At startup”)然后,单击或点击确定(OK)按钮。
如何永久附加 VHD:触发器在启动时
从“创建任务”(“Create Task”)窗口转到“操作”选项卡。(Actions)在其上,单击或点击新建(New)。
如何永久附加 VHD:任务的操作
在“新建操作”(“New Action”)窗口中,在Program/script字段中键入powershell.exe 。然后,在“添加参数(可选)”(“Add arguments (optional)”)文本字段中,键入以下命令:Mount-DiskImage “VHD 文件的路径”。(Mount-DiskImage “Path to the VHD file”.)
显然,将“VHD 文件的路径”(“Path to the VHD file”)更改为要永久挂载的VHD文件的真实路径。完成后,按OK。
如何永久附加 VHD:使用 PowerShell(Use PowerShell)运行 Mount-DiskImage
再次按OK保存“永久挂载 VHD”任务。(OK)
如何永久附加 VHD:在任务计划程序中保存任务(Task Scheduler)
最后一步是输入您的 Windows 10 用户帐户的密码(Password)。键入它并按OK。
输入用户帐户的密码
即使您重新启动 Windows 10 PC,附加的VHD文件也可以根据需要使用。(VHD)如果您决定不再需要访问它,您可以按照本教程下一部分中的步骤分离VHD文件(卸载VHD )。
如何使用磁盘管理分离(Disk Management)VHD映像(卸载VHD)
使用已安装的虚拟映像完成后,您可能需要卸载它。打开计算机管理(Computer Management)并再次选择磁盘管理(Disk Management)。然后,右键单击或按住附加的VHD,然后选择“分离 VHD”(“Detach VHD”)选项。
在 Windows 中卸载 VHD:分离 VHD
单击或点击确定(OK)按钮完成。
分离虚拟硬盘
您现在应该看到磁盘及其所有分区已从“磁盘管理(Disk Management)”窗口中删除。
VHD文件已分离(卸载)
下次打开文件资源管理器(File Explorer)时,您会注意到已分离的VHD分区也不再显示在那里。
如何在Windows 10中使用(Windows 10)VHD文件?
有时您需要来自Windows 备份创建的(Windows Backup)VHD文件或系统映像的单个文件或文件夹。使用磁盘管理(Disk Management)实用程序,您可以轻松挂载VHD文件并复制所需的文件和文件夹。此外,这允许您将文件夹和文件添加到任何图像。根据使用场景 - 此功能可能很有用。最后,您已经看到使用磁盘管理(Disk Management)来挂载和卸载VHD文件一点也不复杂。如果您有任何其他提示要分享,请在评论中告诉我们。
How to open, unmount, or permanently attach a VHD file in Windows 10 -
Windows 10 has an excеllent tool for managing your drives and partitions, called Disk Management. One of its best features is that it allows you to mount and unmount VHD files so that you can work with them as you need. In this guide, we show you how to attach and detach Virtual Hard Disk (VHD) images in Windows 10, as well as how to permanently attach a VHD file that’s always available. If we sparked your interest, read on:
What is the use of VHD (Virtual Hard Disk)?
A Virtual Hard Disk or VHD file is a virtual hard drive image that stores all the data from a hard disk partition or file system, all in a single file. VHD files are usually created and used by virtual machine software such as VirtualBox or Microsoft’s virtualization solution Hyper-V. Additionally, the old Windows Backup tool from Windows 7, which is still present in Windows 10, also saves system images as VHD files.
How do I open a VHD file? (or how to mount a VHD image with Disk Management)
First, open the Computer Management console on your Windows 10 PC. In it, select Disk Management on the left.
Disk Management in Computer Management
On the same left-side panel, right-click or press-and-hold on Disk Management and select the “Attach VHD” option.
Attach VHD in Disk Management
You can also find an “Attach VHD” option in the Action menu from Disk Management, as shown in the screenshot below.
Attach VHD in the Actions menu from Disk Management
Then, Disk Management loads a dialog window called “Attach Virtual Hard Disk.” Type the path to the VHD file that you want to mount or click/tap Browse to find it on your Windows 10 PC.
Attach Virtual Hard Disk
Locate the VHD file to mount and select it. Then press the Open button.
Browse Virtual Disk files and select the one to mount
You are now back to the “Attach Virtual Hard Disk” window. Our advice here is to let the “Read-only” box unchecked so that you can modify the files found inside the VHD image. If you check this box, you can open and copy files from the VHD, but you cannot alter them in any way. Click or tap on OK to open the VHD image.
Attaching a Virtual Hard Disk file
You should now see that the VHD file has been mounted as a separate disk drive, and it has its own drive letter assigned.
In our case, the mounted VHD image included three different partitions found on a Windows 10 system drive. Naturally, only the partition where Windows 10 was installed has a drive letter – I – as you can see in the screenshot below.
The VHD file has been mounted
Open File Explorer and click on the new partition to open it.
A partition from a VHD file shown in File Explorer
Now, you can easily manipulate the desired files from the attached VHD file.
Browsing a VHD file
How do I permanently attach a VHD?
If your question is “How do I permanently attach a VHD?”, here’s what you should do:
Open the Task Scheduler and click or tap on Create Task in the Actions panel.
How to permanently attach a VHD: Create Task in Task Scheduler
In the General tab of the Create Task window, type a name for the VHD permanently mount task. Then, select the “Run whether user is logged on or not” and “Run with highest privileges” options, and choose Windows 10 in the “Configure for” dropdown list.
How to permanently attach a VHD: General settings for the task
In the Triggers tab, click or tap on New.
How to permanently attach a VHD: Triggers for the task
This opens the New Trigger window. In it, select “At startup” from the “Begin the task” list at the top. Then, click or tap the OK button.
How to permanently attach a VHD: Trigger is At startup
Move on to the Actions tab from the “Create Task” window. On it, click or tap New.
How to permanently attach a VHD: Actions for the task
In the “New Action” window, type powershell.exe in the Program/script field. Then, in the “Add arguments (optional)” text field, type this command: Mount-DiskImage “Path to the VHD file”.
Obviously, change the “Path to the VHD file” with the real path to the VHD file that you want to mount permanently. Once you’re done, press OK.
How to permanently attach a VHD: Use PowerShell to run Mount-DiskImage
Press OK once more to save the “permanently mount VHD” task.
How to permanently attach a VHD: Saving the task in Task Scheduler
The final step is to enter the Password of your Windows 10 user account. Type it and press OK.
Entering the password of the user account
The attached VHD file is available to use for as long as you want, even if you restart your Windows 10 PC. If you decide you no longer need to access it, you can detach the VHD file (unmount VHD) by following the steps in the next section of this tutorial.
How to detach a VHD image using Disk Management (unmount VHD)
After you are done working with the mounted virtual image, you might want to unmount it. Open Computer Management and select Disk Management again. Then, right-click or press-and-hold on the attached VHD and choose the “Detach VHD” option.
Unmount VHD in Windows: Detach VHD
Click or tap on the OK button to finish.
Detach Virtual Hard Disk
You should now see that the disk and all its partitions have been removed from the Disk Management window.
The VHD file has been detached (unmounted)
The next time you open File Explorer, you will notice that the detached VHD partitions are no longer shown there either.
How do you use VHD files in Windows 10?
There are times when you need a single file or folder from a VHD file or system image created by Windows Backup. Using the Disk Management utility, you can easily mount the VHD file and copy the files and folders you need. Also, this allows you to add folders and files to any image. Depending on the usage scenario – this feature can be useful. In the end, you’ve seen that using Disk Management to mount and unmount VHD files is not complicated at all. If you have any other tips to share, let us know in a comment.