Wednesday, November 11, 2009

Double click to mount a virtual hard disk (Windows 7 Style)

I have been wanting to come up with a workable solution for mounting virtual hard disks by double clicking on them in Windows 7 for a while now.  The problem is that:

  • There is no easily scriptable API for VHD mounting
  • You need to be elevated (running “As Administrator”) in order to mount a virtual hard disk

The best idea I could think of for a simple solution was to try scripting the DISKPART tool.  Unfortunately – once I got going I got a bit carried away.  The result is this batch file …

Source : Virtual PC Guy's WebLog