Accessing property file through batch script
I'm trying to write a batch script, this script is responsible to launch a jar with one parameters.
This parameter indicate to my jar wich property file to use in order to setup some configuration.
Then the script will zip the results produced by the jar and send them to a location. But in order to set the name of the zip file I would need to be able to read the property file directly from the batch, is there a开发者_如何学运维 way to do so ?
Thanks and regards,
F
@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%
Can you pass it on the command line as an arg and read it in your main()
method ?
java {myclass} %PROP%
or as a Java property and read via System.getProperty()
?
java -DzipName=%PROP% {myclass}
精彩评论