Skip to content

Instantly share code, notes, and snippets.

@amitbhoraniya
Created October 10, 2017 19:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amitbhoraniya/6da4e88cc846d3bac1c5cae39b1e9883 to your computer and use it in GitHub Desktop.
Save amitbhoraniya/6da4e88cc846d3bac1c5cae39b1e9883 to your computer and use it in GitHub Desktop.
@echo off
setlocal ENABLEDELAYEDEXPANSION
set JAVA_OPTS=
rem eol stops comments from being parsed
rem otherwise split lines at the = char into two tokens
for /F "eol=# delims== tokens=1,*" %%a in (test.properties) do (
rem proper lines have both a and b set
rem if okay, assign property to some kind of namespace
rem so some.property becomes test.some.property in batch-land
if NOT "%%a"=="" if NOT "%%b"=="" set "JAVA_OPTS=!JAVA_OPTS!-D%%a=%%b "
)
rem trim last spaces
CALL :TRIM %JAVA_OPT%
rem set java options
set JAVA_OPT=%TRIMRESULT%
rem start tomcat
bin\startup.bat
:TRIM
SET TRIMRESULT=%*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment