> Hi Batch file gurus
>
> I want a batch file to check if a file is open.
>
> I found this one on DosTips.com (very good site - with a good forum).
>
> echo.N|copy /-y NUL
> "%filename%">NUL&&(
> echo.%filename% is free!
> rem leave this rem here at the block end!!!
> ) || (
> echo.%filename% is in use!
> )
>
> Works generally except for the actual file type I want to check, which
> is Excel !!
>
> Works generally here too except if the file is set as ReadOnly in
> Excel.
>
> The batch file returns that the file is free !!
>
> Thanks,
I think you are out of luck. It is quite a while since I have worked with Excel on Windows, but it handles files differently to most programs. Even if you open a file, do not change it and never save it Excel updates the internal date. I suspect Excel reads the file into its internal structure, and writes on close.