I have revisited this issue. Read on for a solution:
After using the suggestions (and web sites listed) in this forum, I have attached a simple batch file (ifExist.bat) that safely test for the existance of any file (with or without a full path), drive, or folder. Here is an example of how to "call" the batch file from within another batch file:
...
call IfExist myfile rc
if %rc% == 0 echo File 'myfile' FOUND
if not %rc% == 0 echo File 'myfile' NOT FOUND
...
------------------------------ BATCH FILE ----------------------------------
:: IfExist.bat
::
:: PURPOSE: Equivalent to the DOS 'IF EXIST ...command.
:: Runs on Windows 98SE and XP.
::
:: IfExist.bat safely tests for the existance of any file (or drive)
:: on any device (Floppy, HD, CD, DVD, ...) without fear of getting
:: the dreaded DOS 'Abort, Retry, Fail?' error message. This
:: error message can occur in DOS if the device (e.g., Floppy)
:: is not present.
::
:: SYNTAX: IfExist [drive][folder][file] var
:: drive - drive (e.g., a:, b:, ..., Y:, Z:)
:: folder - folder
:: file - file name
:: var - name of environmental variable to
:: hold the return code (e.g., rc)
::
:: On return, IfExist.bat sets the return code (var) to:
:: 0 - if 'exist'
:: 1 - if 'non-exist'
::
:: LAST MODIFIED: 11/3/04
@echo off
if %2x == x goto err1
::Init return code to 'non-exist'
set %2=1
::Use ctty nul (disconnect from the standard output). This
:: has the effect of hidding error messages in DOS.
:: %OS% is null for DOS not null for XP (not perfect).
:: ( XP does not support ctty; fortuneatelyt XP doesn't produce
:: the error messages we want to hide)
if %OS%x == x ctty nul
:: Use COMSPEC and DIR to find this file.
::
::Use command.com with the un-publish /f option to force
:: selecting "fail" if an abort-retry-fail error occurs.
%COMSPEC% /F/C DIR %1 | find /i "file(s)" > nul
if not errorlevel 1 if errorlevel 0 set %2=0
::Use ctty con to unhide error messages in DOS.
if %OS%x == x ctty con
goto END
:err1
echo.
echo ---- SYNTAX: %0 [drive][folder][file] var
echo --- ENTERED: %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
echo ERROR: Missing var (name of environmental variable to
echo hold the return code (e.g., rc). Return codes of
echo 0 or 1 means 'exist' or 'non exist', respectively.
echo EXAMPLES: %0 f1 rc
echo %0 K: answer
echo %0 \bin answer
goto END
:END