1.

Solve : if exists -> Quiet please !?

Answer»

Hi,

I created an BootCD with Nero.
I took an changed Win98-Startdisk image for the Boottime.

Now I WANT to start an programm from the CD.
So I ´ve created an batch, that search the right CHARACTER for the CD-ROM.

-----------------
set _dir=
for /F %%i in ("C D E F G H I J K L M N O P Q R S T U V W X Y Z") do if EXIST %%i:\myprog\test.exe set _dir=%%i:\
if "%_dir%" == "" goto _err

----------------

BUT when I start the DOS-CD from my 2nd CD-ROM and the
batch tests the 1th CD-ROM ( there is no CD in it !)
I got an errormessage wich I have to quit with "F" to continue!

Can someone tell me, how I can change my code, so that it
will start automatic ??

I think some like this -> On Error Resume Next in VisualBasic
or a parameter ??

Greetings

ByteThere is no parameter you can use and there is no batch equivalent of "On Error Resume Next".

The problem is the OS will get in the way and issue messages if a drive doesn't exist or is not ready.

A better way is to use a Script:
Code: [Select]
Dim fso, d, dc
Set fso = CreateObject("Scripting.FileSystemObject")
Set dc = fso.Drives
For Each d in dc
If d.DriveType = 4 Then ' select optical drives
If d.IsReady Then
If fso.FileExists(d & "\myprog\test.exe") Then
' <== Put your logic here
END If
End If
End If
Next

Note: script cannot distinguish between DVD drives and CD drives.

Save the file with a VBS extension and include it when running it.

Hope this helps.



Discussion

No Comment Found