Windows 8中是否有任何特殊的API来挂载ISO文件?

Rus*_* F. 6 c# c++ windows-8 windows-8.1

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

Sco*_*ain 8

本机函数调用AttachVirtualDisk.

但是,如果您正在使用C#,就像您的标记所示,可能更容易调用PowerShell并使用其围绕该函数的包装器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();
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)