VOGONS

Common searches


First post, by Lostdotfish

User metadata
Rank Newbie
Rank
Newbie

Does anyone know of a way to automate the mounting of CD images and launching an application?

I use Deamon Tools to mount CD iso/bin+cue and was wondering if anyone knew of a way to write a batch file or similar that can mount a specific ISO and then launch a given application?

Edit - should have mentioned, I'm using Windows 98SE

Reply 1 of 3, by Lostdotfish

User metadata
Rank Newbie
Rank
Newbie

Ok, I worked it out.

@echo off
c:\progra~1\d-tools\daemon.exe -unmount 0
c:\progra~1\d-tools\daemon.exe -mount 0,c:\dir\subdir\disc.cue
choice /T:y,5 /C:yn
C:\dir\subdir\apptorun.exe
cls
@exit

This in a batch file will unmount any current images on DTools device 0, mount your chosen disc image, wait 5 seconds and then start your chosen application.

In testing, a 4 second wait wasn't long enough for the image to mount and the application would fail to launch (if it relies on the CD being present).

I'm still not 100% happy with the way I'm making the script wait 5 seconds... as even with @echo off it displays the Y/N choice for 5 seconds... Sleep and Timeout commands aren't available in Windows 98. If anyone has a better option let me know. I'm aware that you can use ping with a timeout on a fake IP but this feels... just not right.

I also noticed that some of the apps I tested were generating log files in the directory where the batch file was executed from (the same files are generated when running the application by hand in the install directory). Probably best to set these batch files up in the same directory as the application executable and then create shortcuts to the desktop or start menu.

End result, a single action to mount an image and launch an application that requires the CD to be inserted. The motivation for this - I've been letting my 7 and 5 year old play some retro games on my retro PC but teaching them to mount and unmount images is a bit too much for them right now.

Reply 3 of 3, by doshea

User metadata
Rank Member
Rank
Member
Lostdotfish wrote on 2022-04-20, 15:39:

I'm still not 100% happy with the way I'm making the script wait 5 seconds... as even with @echo off it displays the Y/N choice for 5 seconds... Sleep and Timeout commands aren't available in Windows 98. If anyone has a better option let me know. I'm aware that you can use ping with a timeout on a fake IP but this feels... just not right.

Some things you could try:

1. Loop until some file on the CD becomes available, say it has a file called somefile.dat on it:

:wait
if not exist o:\somefile.dat goto wait
rem The CD should be available now

The problem is if O: is unreadable you should get an "Abort, Retry, Fail?" prompt which you don't want. If you start COMMAND.COM with the /F flag, it should automatically choose "Fail". I'm not sure if it will then keep running your batch file; if it does then you could use that loop. You'd need to start your batch file using e.g. COMMAND /F /C mygame.bat then. I'm not 100% sure that this will work though.

2. Use a more powerful scripting tool than batch files: Windows Scripting Host comes with Windows 98 and later, so you can make a VBScript or JScript (or other language if you install it) script. I assume that you should be able to sleep using that, but you'd obviously need to figure out how to run programs using it. I'm afraid I don't remember anything about it except that you could do things like pop up Internet Explorer windows with content generated by the script.

If you have success with either of these methods, I'd be interested to hear about it!