0

I wrote a batch file to run multiple batch files which run a java program separately. I am wondering if I need to pass an argument to the java program when I run it, how do I pass the argument when I start the station batch files? The main batch file looks like this:

@ECHO OFF
set CLASSPATH=.
ECHO open Server 

start Server.bat
ECHO open station1

start station1.bat
ECHO open station2 

start station2.bat
ECHO open station3 

start station3.bat
ECHO open station4 
start station4.bat

The station batch file looks like this:

@ECHO OFF
set CLASSPATH=.
java ClientStation  arg1  arg2   arg3
pause
clinomaniac
  • 2,200
  • 2
  • 17
  • 22
Hongwei Li
  • 79
  • 1
  • 6

1 Answers1

0

Change station.bat from

java ClientStation  arg1  arg2   arg3

to

java ClientStation  %*

which will pass command line arguments on to ClientStation. And when you call it, call it like

start station1.bat arg1 arg2 arg3

Or use %* if you want to pass command line arguments from that script onto station.bat

Elliott Frisch
  • 198,278
  • 20
  • 158
  • 249