@echo off
@cls
if %1 !==! goto Usage 
if %1 == /h goto Usage
if %1 == /H goto Usage
if %1 == /? goto Usage
if %2 !==! goto Usage 
if not exist %1\ime\ISWIN.COM goto WrongDrv
@call %1\ime\ISWIN.COM
if ERRORLEVEL 1 goto DosBox
if exist %2\WIN.COM goto ChkRInst

:WrongDir
echo !!! ERROR -- %2 is not the correct Windows Path-Name !!!
goto Usage

:WrongDrv
echo !!! ERROR -- %1 is not the correct Source Driver-Name !!!
goto Usage

:DosBox
echo !!! ERROR -- You can NOT run this batch file in DOS-BOX of Windows !!!
goto Usage

:Usage
echo Purpose  : This program will 
echo            (1) Install New IMEs provided by Microsoft Office Chinese Version
echo            (2) Save Old IME-related files with Extension-Name ".OLD" 
echo Usage    : INSTIME SourceDir CWIN31Dir
echo Argument : SourceDir is the Driver-Name from there you install New IMEs
echo            CWIN31Dir is the Path-Name of Windows 3.1 Chinese Version
echo Example  : INSTIME A: C:\WINDOWS
echo Warning  : Run this batch file on DOS ONLY (not DOS-BOX of Windows)
goto End

:ChkRInst
if not exist %2\system\FULLABC.OLD goto Install

:RInst
echo !!! ERROR -- You try to Re-Install New IMEs !!!
goto Usage

:Install
echo !!! Install New IMEs Provided by Microsoft Office Chinese Version ...
@if exist %2\system\FULLABC.EXE copy %2\system\FULLABC.EXE %2\system\FULLABC.OLD > %2\null
@if exist %2\system\CHAJEI.IME copy %2\system\CHAJEI.IME %2\system\CHAJEI.OLD > %2\null
@if exist %2\system\PHON.IME copy %2\system\PHON.IME %2\system\PHON.OLD > %2\null
@if exist %2\system\QUICK.IME copy %2\system\QUICK.IME %2\system\QUICK.OLD > %2\null
@if exist %2\system\WINIME.IME copy %2\system\WINIME.IME %2\system\WINIME.OLD > %2\null
@copy %1\ime\IC2CJ.TBL %2\IC2CJ.TBL > %2\null
@copy %1\ime\FULLABC.EXE %2\system\FULLABC.EXE > %2\null
@copy %1\ime\MAIN3.DLL %2\system\MAIN3.DLL > %2\null
@copy %1\ime\CHAJEI.IME %2\system\CHAJEI.IME > %2\null
@copy %1\ime\PHON.IME %2\system\PHON.IME > %2\null
@copy %1\ime\QUICK.IME %2\system\QUICK.IME > %2\null
@copy %1\ime\WINIME.IME %2\system\WINIME.IME > %2\null
echo !!! New IMEs Are Installed Successfully !!!

:End
