Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to create a batch script that will run axis wsdl2java.bat for multiple WSDLs. When I create a batch script with just this code:

wsdl2java.bat
wsdl2java.bat

it would run wsdl2java.bat only once. I guess there is something with wsdl2java.bat batch script itself.

Can someone help me figure out what is the root cause of the problem?

share|improve this question
add comment

3 Answers

up vote 7 down vote accepted

For compatibility with Microsoft's COMMAND, Microsoft's CMD has the bizarre semantic that invoking a command script within another command script terminates the invoking command script at that point.

The correct workaround for this is not the START command. Nor is it invoking a subsidiary command interpreter process with CMD (especially erroneously using /K for /C as well). It is — and has been for a couple of decades — the CALL command.

call wsdl2java.bat
call wsdl2java.bat
share|improve this answer
    
thx for the answer, as well as for explanation. Works for me. As soon as I get some rep, I will vote it up also (: –  dugokontov Aug 2 '11 at 12:03
    
Thanks for the correct answer. I also bow before your SUPERIOR knowledge, yet feel strangely offended by your tone. But hey, whatever floats your boat. –  brandstaetter Aug 2 '11 at 13:00
    
The /C is still a valid method, just not preferred anymore. Deprecated, but still functional... –  Brian Knoblauch Aug 2 '11 at 13:05
    
No, M. Knoblauch. Using a subsidiary command interpreter will prevent any environment changes made in the script from taking effect in the originally invoking command interpreter, which is the usual effect when the script is invoked directly. Both START and CMD /C differ in operation from CALL in ways that mean that they aren't what's wanted in such circumstances as these. –  JdeBP Aug 2 '11 at 15:13
    
@JdeBP: Was call part of MSDOS? Or was that part of DRDOS? –  Nils Aug 2 '11 at 19:42
show 2 more comments

Use cmd.exe /k filename.bat to launch each batchfile.

share|improve this answer
add comment

If I remember correctly, Windows switches completely to the new batch file when you start it from within another batch file and does not return.

The workaround would be to execute

start wsdl2java.bat

-- again, just from the top of my head. I could not find a reliable source in my short google research.

Update: as JdeBP pointed out, mine is the old wrong way. It may have been too obvious that I have not touched the innards of MSDOS or Windows CMD-shell or whatever it's called these days for some decades.

Update2: jeez, I said "off the top of my head".

share|improve this answer
1  
Yeah, back in the MSDOS days, that was the case. I'm not sure if that is still the case though. . . –  surfasb Aug 2 '11 at 8:59
    
I didn't say that it was old, although it is in fact almost as old as callstart dating from approximately 1987. I said that it was wrong. Think carefully about what start actually does and compare and contrast that with what the questioner wants to happen. –  JdeBP Aug 8 '11 at 0:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.