2 :: Batch file to start up Media Controller (Windows)
\r
4 :: This code adapted from sample at www.ericphelps.com
\r
5 :: It automatically determines the install directory
\r
6 :: under Windows XP,NT, & 9X, in order to set the
\r
7 :: Java CLASSPATH for the application.
\r
8 :: It assumes the user runs the batch file by clicking
\r
9 :: on its icon in a windows file explorer window
\r
12 ::First test to see if we are on NT or similar OS by seeing
\r
13 ::if the ampersand is interpreted as a command separator
\r
14 > script echo 1234&rem
\r
15 type script | find "rem"
\r
16 if not errorlevel 1 goto WIN9X
\r
19 echo Running under NT
\r
21 ::Get the current batch file's short path
\r
22 for %%x in (%0) do set INSTALL_DIR=%%~dpsx
\r
23 for %%x in (%INSTALL_DIR%) do set INSTALL_DIR=%%~dpsx
\r
24 echo INSTALL_DIR = %INSTALL_DIR%
\r
28 echo Running under Win9X
\r
29 ::An assumption is made that the batch file is run by double-clicking.
\r
30 ::This means %0 is a short file name and path with no quotes
\r
31 ::Test for quotes by quoting %0
\r
32 if not exist "%0" goto ERROR
\r
33 :: Make a line fragment per http://www.ericphelps.com/batch/lines/frag-dbg.htm
\r
34 echo e 100 "set INSTALL_DIR="> script
\r
37 echo n ~temp.bat>> script
\r
40 debug < script > nul
\r
42 ::Change to the batch file's drive
\r
44 ::Change to the batch file's directory
\r
46 ::Use the TRUENAME command to get the short path
\r
47 truename | find ":" >> ~temp.bat
\r
50 set INSTALL_DIR=%INSTALL_DIR%\
\r
51 echo INSTALL_DIR = %INSTALL_DIR%
\r
55 ::For example, to test the INSTALL_DIR to see if "My.jar" is there.
\r
56 :: - if not exist %INSTALL_DIR%My.jar goto ERROR
\r
59 ::Use the path of the batch file to build the Java CLASSPATH
\r
61 set LIBDIR=%INSTALL_DIR%\lib
\r
62 set CLASSPATH=%LIBDIR%\cidero-common.jar;%LIBDIR%\xercesImpl.jar;%LIBDIR%\xml-apis.jar;%INSTALL_DIR%
\r
64 :: On most systems, once Java is installed, it will be in the user's path.
\r
65 :: If not set the following variable to the full path of the Java
\r
66 :: executable (preferably version 1.5 / J2SE 5.0)
\r
69 :: Run the controller
\r
70 %JAVA% -Djava.library.path=%LIBDIR% -classpath %CLASSPATH% com.cidero.control.MediaController
\r
75 ::Insert error-handling code here
\r