Mount .iso file win windows 8 with a batch file

batch-file, windows, windows-8, windows-8.1

Solution

powershell -Command Mount-DiskImage -ImagePath "C:\winxp.iso" 

see http://technet.microsoft.com/en-us/library/hh848706.aspx

And the entire script "run.ps1" could look like this:

mount-diskimage -imagepath C:\winxp.iso
$d = (get-diskimage C:\winxp.iso | Get-Volume).DriveLetter
$d = $d + ":\setup.exe"
start-process "$d" -wait 
dismount-diskimage -imagepath C:\winxp.iso

- line - mounting image (use "" if there are spaces in the path)

- line - get drive letter assigned to the iso

- line - construct execution command from the iso

- line - execute the command and wait until it is completed

- line - unmount iso

it's powershell script so you need to run it from context menu or from cmd as

powershell C:\...\run.ps1

if it says something about system restriction you need to run powershell and the command

set-executionpolicy unrestricted

Problem

I have a game which i have backed up to an iso file (the disk drive in my laptop is noisy), and want to run it from a single shortcut without having to mount the iso file every time. I run windows 8.1 so the iso files mount natively. Any ideas?

Original source