@ECHO OFF
SETLOCAL
SET BATDIR=%~dp0

SET TCL=tclsh.exe
SET SDX=%BATDIR%sdx-20110317.kit
SET GUI=%BATDIR%tclkit-gui-860.exe
SET CLI=%BATDIR%tclkit-cli-860.exe

IF "%1" EQU "" (
  ECHO USAGE: [CALL] %~nx0 FileName.tcl [GUI]
  EXIT /B 1
)

IF /I "%2" EQU "GUI" (
  SET RUNTIME=%GUI%
) ELSE (
  SET RUNTIME=%CLI%
)

(%TCL% %SDX% qwrap %1 -runtime %RUNTIME%) && (MOVE %~dpn1 %~dpn1.exe)
