@ ECHO off
  REM LOADFIX R1.01   Loading applications above low memory (first 64Kb).
  REM Copyright (c) 1997,1998 Caldera, Inc.  All rights reserved.
  REM
  REM Last edit: 98-01-02 MPAUL
  REM

  IF ""=="%1" GOTO help
  FOR %%x IN (%1 %2 %3 %4 %5 %6 %7 %8 %9) DO IF "/H"=="%%x" GOTO help
  FOR %%x IN (%1 %2 %3 %4 %5 %6 %7 %8 %9) DO IF "-H"=="%%x" GOTO help
  FOR %%x IN (%1 %2 %3 %4 %5 %6 %7 %8 %9) DO IF "/h"=="%%x" GOTO help
  FOR %%x IN (%1 %2 %3 %4 %5 %6 %7 %8 %9) DO IF "-h"=="%%x" GOTO help
  FOR %%x IN (%1 %2 %3 %4 %5 %6 %7 %8 %9) DO IF "/HELP"=="%%x" GOTO help
  FOR %%x IN (%1 %2 %3 %4 %5 %6 %7 %8 %9) DO IF "-HELP"=="%%x" GOTO help
  FOR %%x IN (%1 %2 %3 %4 %5 %6 %7 %8 %9) DO IF "/help"=="%%x" GOTO help
  FOR %%x IN (%1 %2 %3 %4 %5 %6 %7 %8 %9) DO IF "-help"=="%%x" GOTO help
  FOR %%x IN (%1 %2 %3 %4 %5 %6 %7 %8 %9) DO IF "/Help"=="%%x" GOTO help
  FOR %%x IN (%1 %2 %3 %4 %5 %6 %7 %8 %9) DO IF "-Help"=="%%x" GOTO help
  IF "/?"=="%1" GOTO help
  IF "-?"=="%1" GOTO help
  IF "/?"=="%2" GOTO help
  IF "-?"=="%2" GOTO help
  IF "/?"=="%3" GOTO help
  IF "-?"=="%3" GOTO help
  IF "/?"=="%4" GOTO help
  IF "-?"=="%4" GOTO help
  IF "/?"=="%5" GOTO help
  IF "-?"=="%5" GOTO help
  IF "/?"=="%6" GOTO help
  IF "-?"=="%6" GOTO help
  IF "/?"=="%7" GOTO help
  IF "-?"=="%7" GOTO help
  IF "/?"=="%8" GOTO help
  IF "-?"=="%8" GOTO help
  IF "/?"=="%9" GOTO help
  IF "-?"=="%9" GOTO help
  IF "?"=="%1" GOTO help

  IF NOT "4"=="%@Eval[2+2]%" GOTO start

  IF NOT ""=="%/%" FOR %%x IN (%1 %2 %3 %4 %5 %6 %7 %8 %9) DO IF "%/%H"=="%%x" GOTO help
  IF NOT ""=="%/%" FOR %%x IN (%1 %2 %3 %4 %5 %6 %7 %8 %9) DO IF "%/%h"=="%%x" GOTO help
  IF NOT ""=="%/%" FOR %%x IN (%1 %2 %3 %4 %5 %6 %7 %8 %9) DO IF "%/%HELP"=="%%x" GOTO help
  IF NOT ""=="%/%" FOR %%x IN (%1 %2 %3 %4 %5 %6 %7 %8 %9) DO IF "%/%help"=="%%x" GOTO help
  IF NOT ""=="%/%" FOR %%x IN (%1 %2 %3 %4 %5 %6 %7 %8 %9) DO IF "%/%Help"=="%%x" GOTO help
  IF NOT ""=="%/%" IF "%/%?"=="%1" GOTO help
  IF NOT ""=="%/%" IF "%/%?"=="%2" GOTO help
  IF NOT ""=="%/%" IF "%/%?"=="%3" GOTO help
  IF NOT ""=="%/%" IF "%/%?"=="%4" GOTO help
  IF NOT ""=="%/%" IF "%/%?"=="%5" GOTO help
  IF NOT ""=="%/%" IF "%/%?"=="%6" GOTO help
  IF NOT ""=="%/%" IF "%/%?"=="%7" GOTO help
  IF NOT ""=="%/%" IF "%/%?"=="%8" GOTO help
  IF NOT ""=="%/%" IF "%/%?"=="%9" GOTO help

:start
  IF EXIST loadfix.com GOTO loadfix
  ECHO LOADFIX R1.01   Loading applications above low memory (first 64Kb).
  ECHO Copyright (c) 1997,1998 Caldera, Inc.  All rights reserved.
  ECHO.
  REM Force a syntax error to see if MEMMAX complains.
  REM It does so with the new MEMMAX 2.04+, which supports /B.
@ CALL memmax /.>\dev\nul
  IF NOT ERRORLEVEL 1 GOTO old_ver
@ CALL memmax /B>%Temp%\loadfix$.bat
  IF NOT EXIST %Temp%\loadfix$.bat GOTO error
  ECHO Temporarily disabling lower memory for this application...
  ECHO.
@ CALL memmax -L>\dev\nul
@ IF "4"=="%@Eval[2+2]%" GOTO start10
@ IF ""=="%/%" GOTO start10
  REM This may fail if we are not using COMMAND, but that's all we can do...
@ %ComSpec% %/%C %1 %2 %3 %4 %5 %6 %7 %8 %9
  GOTO start20

:start10
@ %ComSpec% /C %1 %2 %3 %4 %5 %6 %7 %8 %9

:start20
@ IF EXIST %Temp%\loadfix$.bat CALL %Temp%\loadfix$.bat
@ IF EXIST %Temp%\loadfix$.bat DEL %Temp%\loadfix$.bat>\dev\nul
  GOTO end

:loadfix
@ CALL loadfix.com %1 %2 %3 %4 %5 %6 %7 %8 %9
  GOTO end

:old_ver
  ECHO Error: This older version of MEMMAX is not supported by LOADFIX.
  ECHO        Please use MEMMAX manually.
  ECHO.
  GOTO end

:error
  ECHO Error: An error occured using LOADFIX/MEMMAX.
  ECHO        Please use MEMMAX manually.
  ECHO.
  GOTO end

:help
@ CALL memmax /H
  ECHO.
  ECHO Some applications have problems when they are run from low memory (with
  ECHO DOS=HIGH). This especially includes programs which have been linked
  ECHO with older versions of MS LINK, or have been compressed by MS EXEPACK.
  ECHO To avoid this problem, LOADFIX can be used to temporarily disable low memory
  ECHO (-L), loading the application above the first 64 Kb. A permanent fix could
  ECHO be to decompress such applications, and compress them using a 3rd party
  ECHO compressor (many utilities have built-in support for this problem).
  ECHO.
  IF "4"=="%@Eval[2+2]%" GOTO help10
  IF ""=="%/%" GOTO help10
  ECHO LOADFIX [%/%H] [program [parameters]]
  ECHO.
  GOTO end

:help10
  ECHO LOADFIX [/H] [program [parameters]]
  ECHO.

:end
  REM Dummy
  REM Dummy
