I am trying to modify a certain property in my csm.properties by executing a script.
I looked up a lot and in the end, came to this code.
set "search=CLASSPATH"
set "insert=CLASSPATH^=plugins^/Numbering.jar^^:"
set "textFile="%workingPlace%bincsm.properties""
FOR /f "delims=" %%i in ('type "%textFile%" ^& break ^> "%textFile%" ') do (
FOR /f "tokens=1*delims==" %%g IN ("%%i") DO (
IF /i "%%g" == %search% (
set "line=%%i"
setlocal enabledelayedexpansion
>>"%textFile%" echo(!line:%search%=%insert%!
endlocal
)ELSE (
%%i
)
)
)
This code should read every line in my file and use =
as a delimiter. If the code gets "CLASSPATH" as property, that line should get modified.
But it seems like CLASSPATH isn't found.
This is how csm.properties looks like:
#Tue Jul 10 08:50:23 CEST 2018
JAVA_ARGS=-Xmx20000M -DLOCALCONFIG=true -splash:data/splash.png -Dmd.class.path=$java.class.path -Dcom.nomagic.osgi.config.dir=configuration -Desi.system.config=data/application.conf -Dlogback.configurationFile=data/logback.xml -Dsun.locale.formatasdefault=true -Dinitial.user.language=de
JAVA_HOME=jre1.8.0_152
BOOT_CLASSPATH=lib/xalan.jar
MAIN_CLASS=com.nomagic.osgi.launcher.ProductionFrameworkLauncher
MAC_JAVA_ARGS="-Xdock:name=Cameo Systems Modeler" -Xdock:icon=bin/md.icns -Dapple.laf.useScreenMenuBar=true
APP_ARGS=
DEFAULT_MEMORY_SETTINGS_64=-Xmx[30%,1200,4000]M
DEFAULT_MEMORY_SETTINGS_32=-Xmx800M
CLASSPATH=lib/patch.jar:lib/brand_api.jar
CONSOLE=false
After modifications, CLASSPATH
should look like this:
CLASSPATH=plugins/Numbering.jar:lib/patch.jar:lib/brand_api.jar
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…