Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 602
Ruslan F. Avatar asked Apr 11 '15 19:04

Ruslan F.


1 Answers

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();
            }
        }
    }
}
like image 119
Scott Chamberlain Avatar answered Sep 29 '22 11:09

Scott Chamberlain