Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mount .iso file win windows 8 with a batch file [closed]

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?

like image 819
adewdropnun Avatar asked Dec 18 '13 15:12

adewdropnun


1 Answers

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
  1. line - mounting image (use "" if there are spaces in the path)
  2. line - get drive letter assigned to the iso
  3. line - construct execution command from the iso
  4. line - execute the command and wait until it is completed
  5. 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
like image 76
tskala Avatar answered Sep 19 '22 01:09

tskala