Accessing properties file via batch script

I am trying to write a batch script, this script is responsible for starting a jar with one parameter.

This setting tells my jar properties file wich to use it to set up some configuration.

The script will then close the jar generated results and send them to the location. But in order to set the zip file name I would have to read the properties file directly from the package, is there a way to do this?

Thanks and greetings,

R

+2


a source to share


2 answers


@echo off
setlocal
set FN=filename
set TARGET=propertyname
FOR /F "tokens=1,2 delims==" %%A IN (%FN%) DO IF "%%A"=="%TARGET%" set FOUND=%%B
echo %FOUND%

      



+1


a source


Can you pass it on the command line as an argument and read it in your method main()

?

java {myclass} %PROP%

      



or as a Java property and read through System.getProperty()

?

java -DzipName=%PROP% {myclass}

      

0


a source







All Articles