Windows 8 中是否有任何特殊的 API 来挂载 ISO 文件? [英] Is there any special API in Windows 8 to Mount ISO files?

查看:32
本文介绍了Windows 8 中是否有任何特殊的 API 来挂载 ISO 文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您可能知道 Windows 资源管理器允许将 ISO 文件挂载到虚拟驱动器.是否有任何 API 可用于执行此操作?

As you may know Windows Explorer allows to mount ISO files to a virtual drive. Is there any API which can be used to do this?

推荐答案

本机函数调用 AttachVirtualDisk.

The native function call AttachVirtualDisk.

但是,如果您像标签一样使用 C#,则只需 调用可能会更容易输出到 PowerShell 并在该函数周围使用其包装器 Mount-磁盘映像

However, if you are using C# like your tags suggest it may be easier to just call out to PowerShell and use its wrapper around that function Mount-DiskImage

using System.Management.Automation;

namespace IsoMountTest
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var isoPath = @"C:\Foo\bar.iso";
            using (var ps = PowerShell.Create())
            {
                ps.AddCommand("Mount-DiskImage").AddParameter("ImagePath", isoPath).Invoke();
            }
        }
    }
}

这篇关于Windows 8 中是否有任何特殊的 API 来挂载 ISO 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆