@echo off
echo.
echo Get information on filesystem for partition %1 %2

if exist _write_._ok del _write_._ok > NUL
echo test > _write_._ok
if exist _write_._ok goto writeok
echo.
echo ERROR: The current directory is write-protected or the disk is full
echo.
echo        Please change the current directory to a disk or diskette
echo        with more than 100Kb of available space ...
echo.
goto end
:writeok
if exist _write_._ok del _write_._ok > NUL

if "%0"=="DFSCTEST"     echo on
if "%0"=="dfsctest"     echo on

if "%OS2_SHELL%"=="" goto notos2
set dfsexe=dfsos2.exe
set cmdext=CMD
set ckname=dfso
goto dfsee
:notos2
if "%OS%"==""        goto notnt
if "%OS%"=="DOS"     goto notnt
if "%OS%"=="MSDOS"   goto notnt
if "%OS%"=="DRDOS"   goto notnt
if "%OS%"=="IBMDOS"  goto notnt
if "%OS%"=="OPENDOS" goto notnt
set dfsexe=dfswin.exe
set cmdext=BAT
set ckname=dfsw
goto dfsee
:notnt
set dfsexe=dfsdos.exe
set cmdext=BAT
set ckname=dfsd
:dfsee

if "%1" == "?"   goto usage
if "%1" == "/?"  goto usage
if "%1" == "-?"  goto usage

%dfsexe% -b -q query RValid
if not errorlevel 1 goto work
echo.
echo NOTE: Your DFSee version is not properly registred, this will cause
echo       some extra delays and reminder messages to be displayed  ...
echo.

:work
%dfsexe% -batch -w -time dfscheck -screen %1 %2

:showerrors
if errorlevel 235 goto failure
if errorlevel 234 goto noscript
if errorlevel 001 goto failure

echo.
echo Resulting DFSee check logfiles:
dir %ckname%*.b*%1 %ckname%*.i*%1 %ckname%*.p*%1
echo.
echo email file(s) to support@dfsee.com for analysis (ZIP if possible)
echo Include as many details about any perceived problem as you can.
echo.
goto end

:noscript
echo.
echo ERROR: The required DFSee script 'DFSxxxx.dfs' was not found.
echo Either the type is NOT supported, or the script is missing.
echo Check if it is in the current directory, the same directory
echo as the execuatable %dfsexe% or a directory on the PATH.
goto end

:failure
echo.
echo WARNING: Execution of the script seems to have failed.
echo.
echo Check if %dfsexe% and the script file 'DFSxxxx.dfs' can be
echo found in the current directory, or a directory on the PATH.

:usage
%dfsexe% dfscheck -?
echo.
echo You can use the '-screen-' option to the command to prevent
echo the final completion message, requiring manual confirmation.
:end
