Batch Files

Got questions? Got answers? Go here for both.

Moderator: MaxCoderz Staff

Post Reply
User avatar
Wesley
Regular Member
Posts: 137
Joined: Sun 12 Oct, 2008 1:42 am
Location: Boise, Idaho
Contact:

Batch Files

Post 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
ImageImage
ImageImage
Image
User avatar
Eeems
New Member
Posts: 16
Joined: Sat 28 Feb, 2009 9:37 pm
Location: Edmonton, Alberta
Contact:

Re: Batch Files

Post by Eeems »

open notepad, type in the commands and save it but put .bat as the extension when you save it
ImageImageImageImageImageImageImageImage
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Re: Batch Files

Post by benryves »

Or, assuming Windows, give it an extension of .cmd :)
polarBody
New Member
Posts: 23
Joined: Wed 02 Sep, 2009 3:01 pm
Location: Chicago, IL

Re: Batch Files

Post 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 :)
User avatar
Wesley
Regular Member
Posts: 137
Joined: Sun 12 Oct, 2008 1:42 am
Location: Boise, Idaho
Contact:

Re: Batch Files

Post 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...
ImageImage
ImageImage
Image
Post Reply