1@echo off
2setlocal
3
4set dir=%~dps0
5if exist "%dir%cgconfig.bat" (
6  call %dir%cgconfig.bat
7  goto getwish
8)
9if exist "%dir%..\cgconfig.bat" call "%dir%..\cgconfig.bat"
10
11:getwish
12if "%CG_BIN_DIR%" == "" set CG_BIN_DIR=%dir%
13
14if exist "%dir%cgiowish.exe" (
15  set wish=%dir%cgiowish.exe
16  goto getscript
17)
18if exist "%dir%cgnstools\cgiowish.exe" (
19  set wish=%dir%cgnstools\cgiowish.exe
20  goto getscript
21)
22echo cgiowish.exe not found
23pause
24goto done
25
26:getscript
27if exist "%dir%cgnsview.tcl" (
28  set script=%dir%cgnsview.tcl
29  goto run
30)
31if not "%CG_LIB_DIR%" == "" (
32  if exist "%CG_LIB_DIR%\cgnsview.tcl" (
33    set script=%CG_LIB_DIR%\cgnsview.tcl
34    goto run
35  )
36)
37if exist "%dir%..\share\cgnsview.tcl" (
38  if "%CG_LIB_DIR%" == "" set CG_LIB_DIR=%dir%..\share
39  set script=%dir%..\share\cgnsview.tcl
40  goto run
41)
42echo cgnsview.tcl not found
43pause
44goto done
45
46:run
47start "" /b "%wish%"  "%script%" %1
48
49:done
50endlocal
51