Mount an ISO from the Command Line and Get its Drive Letter in Windows 8

I am making a batch script which mounts an ISO file and installs an app (VS 2012) from the mounted location like this:

K:\Softwares\VS12.iso
%DRIVE_LETTER%:\vs_ultimate.exe /passive /norestart

But the problem is to get the drive letter in which the ISO is mounted. Does anyone know a way to get the drive letter?


Solution 1:

Try this:

for /f "tokens=3 delims=\:" %%d in ('reg query hklm\system\mounteddevices ^| findstr /c:"5C003F00" ^| findstr /v "{.*}"') do (  
    if exist %%d:\vs_ultimate.exe %%d:\vs_ultimate.exe /passive /norestart
)