Here's an example for a batch program that works fine in windows 7.
All you have to modify to use the code is the 3 top lines: 1) Location of .mds file to mount; 2) location of DTLite or the standard edition of DT program; 3) location of program to run after mount.
Modify and it should automatically add a scsi drive, mount mds file to it, launch program to run while mounted and after closing that program: remove the drive again!
All you have to modify to use the code is the 3 top lines: 1) Location of .mds file to mount; 2) location of DTLite or the standard edition of DT program; 3) location of program to run after mount.
Modify and it should automatically add a scsi drive, mount mds file to it, launch program to run while mounted and after closing that program: remove the drive again!
Code:
@echo off set mds_file="D:\Some Directory\mds\Some Image File.mds" set DTLite="C:\Program Files (x86)\DAEMON Tools Lite\DTLite.exe" set Prg_run="D:\Some Directory\Project\Program to run.exe" IF NOT EXIST %mds_file% goto missing_mds IF NOT EXIST %DTLite% goto missing_DTLite IF NOT EXIST %Prg_run% goto missing_PrgToRun echo MDS location : %mds_file% ok! echo DTLite location : %DTLite% ok! echo Program location: %Prg_run% ok! echo. %DTLite% -get_count scsi set scsi_count=%errorlevel% echo Number of scsi virtual drives already: %scsi_count% echo. echo Adding scsi virtual drive... %DTLite% -add scsi echo. if errorlevel 0 goto get_letter if errorlevel -1 goto error_add :get_letter %DTLite% -get_letter scsi, %scsi_count% if errorlevel 0 goto mount_image if errorlevel -1 goto error_letter :mount_image echo Scsi virtual drive letter %errorlevel% ok! echo (Drive letter: D=3, E=4, F=5, G=6, H=7, I=8, J=9, K=10, ...) echo. echo Mounting image... %DTLite% -mount scsi, %scsi_count%, %mds_file% if errorlevel 0 goto remove if errorlevel -1 goto error_mount :remove echo Mount ok! echo. echo Running: %Prg_run% %Prg_run% echo. echo Removing used scsi virtual drive... %DTLite% -remove scsi, %scsi_count% exit :missing_DTLite echo Error: Not found %DTLite%. goto exit :missing_mds echo Error: File not found %mds_file%. goto exit :missing_PrgToRun echo Error: Program to run file not found %Prg_run%. goto exit :error_add echo Failed to add new scsi virtual drive! goto exit :error_letter echo Could not retrieve scsi virtual drive letter! :error_mount echo Error: Unable to mount image file %mds_file%! goto exit :exit pause