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
gpa
  • 2,411
  • 6
  • 38
  • 68

3 Answers3

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%
grepit
  • 21,260
  • 6
  • 105
  • 81
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
Jiri Kremser
  • 12,471
  • 7
  • 45
  • 72
-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.

Manisha Mahawar
  • 627
  • 6
  • 9