Reputation: 5394
Say I have an XML file.
<!-- File: "java.xml" -->
<java>
<classpath>C:\path\to\my\classes\</classpath>
</java>
or
// File: "java.txt"
C:\path\to\my\classes\
C:\path\to\something\else\
C:\an\other\command\line\argument\
Is it possible to have a batch file to read a XML file or even something as simple as just an ordered list of strings in a text file separated by new lines \n
. Then call a global command line tool such as java
and pass it arguments found in the example file java.xml
.
C:\Users>java -classpath C:\path\to\my\classes\
Upvotes: 0
Views: 302
Reputation: 5394
Managed to work it out in the end using stuff I found here:
"java.txt"
C:\path\to\my\classes
"java.bat"
@echo off
setlocal ENABLEDELAYEDEXPANSION
set vidx=0
for /F "tokens=*" %%A in (Presets/Scripts/java.txt) do (
SET /A vidx=!vidx! + 1
set var!vidx!=%%A
)
set var
java -classpath %var1%
pause
Upvotes: 1