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

最后都变了- 提交于 2021-01-27 04:53:51

问题


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?


回答1:


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


来源:https://stackoverflow.com/questions/20662684/mount-iso-file-win-windows-8-with-a-batch-file

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