Page 1 of 1

Batch Files

Posted: Fri 02 Oct, 2009 10:50 pm
by Wesley
So, I was just curious. How would I create a batch file that ran a command when I opened it (or double clicked it)?

For instance, I want the command line to execute:
>javac *.java

Re: Batch Files

Posted: Sat 03 Oct, 2009 12:24 am
by Eeems
open notepad, type in the commands and save it but put .bat as the extension when you save it

Re: Batch Files

Posted: Sat 03 Oct, 2009 12:51 am
by benryves
Or, assuming Windows, give it an extension of .cmd :)

Re: Batch Files

Posted: Sat 03 Oct, 2009 12:54 am
by polarBody
For larger projects, you might want to look into makefiles. Makefiles allow you to easily compile only the source files that were altered since the last compilation, instead of recompiling all source files every time. I don't know if they're double-clickable, though :)

Re: Batch Files

Posted: Sat 03 Oct, 2009 12:55 am
by Wesley
Okay, but what if I want to use the command:
java MakeChange

and the program MakeChange uses the command line?

I tried putting the command in a .cmd file (it works for .bat too), but it keeps running the command over and over again, infinitely...