1 command on multiple lines in a .bat file

Solved
elouise Posted messages 5 Registration date   Status Membre -  
 Jacquo -
Hello,
I just realized that I have already posted this message as a reply, I apologize, it's my first time participating in an internet forum.

My question is the following:

Can we write a command over several lines in a batch file? I have Java commands with several options that make the command line too long, can I split it? If so, how?
Thank you.
Configuration: Windows XP Firefox 2.0.0.9

5 réponses

elouise Posted messages 5 Registration date   Status Membre 4
 
Hello,
I would like to thank you again.

The solution is finally as follows:
instead of using \ to break the line like in UNIX, we use ^ under Windows.

Thank you, so issue resolved.
3
Jacquo
 
Thank you for the solution.
0
dubcek Posted messages 18814 Registration date   Status Contributeur Last intervention   5 655
 

xxx \ aa \ bb \ cc 
0
elouise Posted messages 5 Registration date   Status Membre 4
 
Hello,
Thank you for getting back to me.
Here’s what I tried to do:
here is my command in the script.bat file:
java -cp .;..\..\Javasys -Dtlcif.ram.target=tlcif.ram.jvm.Jram -Dtlcif.ram.symtab=none -Dtlcif.ram.code=elevcct.JramApp elevcct.DemoGUI

it’s on a single line, with what you suggested it becomes:

java -cp .;..\..\Javasys -Dtlcif.ram.target=tlcif.ram.jvm.Jram line_break
-Dtlcif.ram.symtab=none -Dtlcif.ram.code=elevcct.JramApp elevcct.DemoGUI

with line_break = xxx \ or aa \ or \ bb or cc

here is the error it gives for cc and the same error occurs for the other line_break:

>script

>java -cp .;..\..\Javasys -Dtlcif.ram.target=tlcif.ram.jvm.Jram cc
Exception in thread "main" java.lang.NoClassDefFoundError: cc

>-Dtlcif.ram.symtab=none -Dtlcif
ram.code=elevcct.JramApp elevcct.DemoGUI
'-Dtlcif.ram.symtab' is not recognized as an internal or external command,
operable program or batch file.

Could you tell me if this is the right way to proceed?
Thank you.
0
dubcek Posted messages 18814 Registration date   Status Contributeur Last intervention   5 655
 
the last character of the line before <enter> is the \
java -cp .;..\..\Javasys -Dtlcif.ram.target=tlcif.ram.jvm.Jram \<enter>
-Dtlcif.ram.symtab=none -Dtlcif.ram.code=elevcct.JramApp elevcct.DemoGUI
0
elouise Posted messages 5 Registration date   Status Membre 4
 
Hello,
Thank you for responding again.
The solution you propose is for the UNIX (Linux) system, not for Windows. The \ is used to escape the character that follows it, so it represents a line break on Unix. On Windows, there are two characters for end of line and carriage return.

There is the solution of environment variables, but our command can remain long if we have many options.
Thank you.
0