echo off
echo ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
echo ³ Record program usage                              ³
echo ³ By Prof. Timo Salmi, ts@chyde.uwasa.fi, 10-Jul-91 ³
echo ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ

rem The purpose of this batch is to record program usage to
rem a program usage log file
rem *******************************************************

rem The path and name of the logfile:
rem Change the path to suit yours!
rem If you get an "Out of environment space" message, increase your
rem environment space by using shell configuration in config.sys:
rem Example: shell=c:\bin\command.com /e:1024 /p
if not exist r:\nul goto _err2
set logfile_=r:\proguse.log

rem Check for errors
if "%1"=="" goto _help
if not exist %1 goto _err1

rem Record time and date
echo Calling %1 at >> %logfile_%
echo.|time >> %logfile_%
echo.|date >> %logfile_%

rem Here the actual program is called.
rem %1 is the name of the program, and it must include the path and
rem the extension.
rem If you do not want to have to use the path, make another batch
rem which calls your program by calling this batch. See link1.bat
rem and link2.bat for how to call a batch from another batch.
rem %2 through %9 take care of the parameters possibly needed in
rem your program call
%1 %2 %3 %4 %5 %6 %7 %8 %9

rem Concluding message
echo ******************************************************************* >> %logfile_%
echo Usage of %1 recorded to %logfile_%
goto _out

:_err1
echo File %1 not found
goto _out

:_err2
echo The drive or directory for proguse.log not found, see batch remarks
goto _out

:_help
echo.
echo Usage: LOGRUN ProgramNameWithPathAndExtension [param1] [param2] [...]
echo.
echo See the remarks in LOGRUN.BAT for more information
:_out
set logfile_=
echo on
