My uncreative and stupid batch file scripting solution

I hate batch files.

I don’t even know why I hate batch files. Maybe because of the awkwardness of the language itself, the difficulty in adding one number to another number.

Or perhaps because everyone writes so called ‘viruses’ with batch files when they’re 12 years old. The ones that randomly open 50 windows and won’t quit.

After some time I’ve come to loathe this icon –

Hosted by

So when deploying an application, I feel like, ‘Ant, Maven, Jar, anything. No way I’m using a batch file’.

Except you can’t really send your game to your friend and tell her, ‘So you open command prompt, navigate to my game using cd.., then type this: java -Xmx=256m -cp .;./lib/jogl-251106.jar;./lib/openal_951_c.jar game.Main…’

Nono, that doesn’t work. Instead you defeatedly write up a batch file.

Then today I had an absolutely genius (not) idea. Everyone likes .exe files. What if instead of bat files, I had exe files that did the same thing?

So while normally you would have this code:

@echo off
java -Xmx=256m -cp .;./lib/jogl-251106.jar;./lib/openal_951_c.jar game.Main

I would instead have this code:

int main() {
system("java -Xmx=256m -cp .;./lib/jogl-251106.jar;./lib/openal_951_c.jar game.Main");
return 0;

..which does the exact same thing with more syntax.

A ‘solution’

But that’s really tedious and dumb, I said to myself. So instead, I wrote this java program to generate the c code and call GCC to compile it.

Therefore, instead of writing this code:

int main() {
system("java -Xmx=256m -cp .;./lib/jogl-251106.jar;./lib/openal_951_c.jar game.Main");
return 0;

.. I would only have to write this code:

java -Xmx=256m -cp .;./lib/jogl-251106.jar;./lib/openal_951_c.jar game.Main

Aha, I’ve come to a full circle. Now I created a mini-language with even less functionality than a batch file, and somehow I’ve convinced myself that this 16kb exe is still better than the 97 byte batch file.

But for some reason it seemed like a good idea at the time.

In other news

It seems like I did fairly well in the Cayley contest this year. I came into group IV, between 136 and 140 points (out of 150). This is the best in my school and second best in Calgary.

I got the second last question wrong, and did not answer the last question.

The CCC results aren’t out yet, and it was around the same time as this contest so they should be out soon now.

The Euclid contest is this wednesday, and the Galois this friday.

I’ve switched from using tabs into spaces. Probably because tabs caused so much problems with Haskell layout. Vim supports soft tabs, so ‘:set ts=4 sts=4 sw=4 et’ and you’re all set to use spaces. ‘:retab’ converts the tabs to spaces, which may be useful.

2 thoughts on “My uncreative and stupid batch file scripting solution

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s