Is there any special API in Windows 8 to Mount ISO files?

微笑、不失礼 提交于 2021-02-07 03:18:15

问题


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?


回答1:


The native function call AttachVirtualDisk.

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();
            }
        }
    }
}


来源:https://stackoverflow.com/questions/29582207/is-there-any-special-api-in-windows-8-to-mount-iso-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!