mesclient-startup.bat 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. @echo off
  2. setlocal
  3. rem This file can be copied directly to the Windows Startup folder.
  4. rem The JAR is expected to be in the same directory as this BAT file.
  5. set "MES_CLIENT_HOME=%~dp0"
  6. set "MES_CLIENT_HOME=%MES_CLIENT_HOME:~0,-1%"
  7. rem If the JAR is installed outside the Startup folder, set its full path here.
  8. rem Example: set "MES_CLIENT_JAR=C:\MesClient\mesclient.jar"
  9. set "MES_CLIENT_JAR=D:\mesclient-sd.jar"
  10. rem An optional first argument can also explicitly select the JAR file.
  11. if not "%~1"=="" set "MES_CLIENT_JAR=%~1"
  12. if not defined MES_CLIENT_JAR (
  13. for %%F in ("%MES_CLIENT_HOME%\*.jar") do (
  14. set "MES_CLIENT_JAR=%%~fF"
  15. goto :jar_found
  16. )
  17. )
  18. :jar_found
  19. if not defined MES_CLIENT_JAR exit /b 1
  20. if not exist "%MES_CLIENT_JAR%" exit /b 1
  21. cd /d "%MES_CLIENT_HOME%"
  22. rem Keep the process independent of the Startup-folder command window.
  23. if exist "%MES_CLIENT_HOME%\lib" (
  24. start "MES Client" /b javaw -cp "%MES_CLIENT_JAR%;%MES_CLIENT_HOME%\lib\*" com.mes.ui.MesClient
  25. ) else (
  26. start "MES Client" /b javaw -jar "%MES_CLIENT_JAR%"
  27. )
  28. endlocal