2

I have following command line batch file

REM test
call java -server -Xms2048m -Xmx4096m -XX:MaxPermSize=512m -Dlog4j.configuration=file:///C:/codex/props/log4j.xml -Dlog4j.output.dir=C:/logs//codex-logs -jar codex-1.0.jar

Question is that is there anyway file can be maintain format having carriage return lines?

something like following for better reading and maintainability???

REM test
call java -server -Xms2048m -Xmx4096m -XX:MaxPermSize=512m 
-Dlog4j.configuration=file:///C:/codex/props/log4j.xml 
-Dlog4j.output.dir=C:/logs//codex-logs 
-jar codex-1.0.jar
2

3 Answers 3

2

I think Jiri Kremser's answer is correct but if your goal is "better reading and maintainability" , you can use variables too:

REM test

set var1=java -server -Xms2048m -Xmx4096m -XX:MaxPermSize=512m
set var2=-Dlog4j.configuration=file:///C:/codex/props/log4j.xml
set var3=-Dlog4j.output.dir=C:/logs//codex-logs
set var4=-jar codex-1.0.jar

echo %var1% %var2% %var3% %var4%

call %var1% %var2% %var3% %var4%
Sign up to request clarification or add additional context in comments.

1 Comment

@gpa, also you 1+ for my answer would be well appreciated :)
1

Use the character ^ for it

REM test
call java -server -Xms2048m -Xmx4096m -XX:MaxPermSize=512m^ 
-Dlog4j.configuration=file:///C:/codex/props/log4j.xml^ 
-Dlog4j.output.dir=C:/logs//codex-logs^ 
-jar codex-1.0.jar

Comments

-1

I believe adding simply the backslash '\' at the end of each line will allow you make it behave like one line. Since it escapes the newline character.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.