Game Development Community

Launching TGB with a batch file?

by Pete Michaud · in Technical Issues · 09/17/2009 (8:31 am) · 4 replies

I created a dead simple batch file to launch TGB and Torsion with one shortcut. All it does is:

start "TGB" "D:\Program Files\GarageGames\TorqueGameBuilder-1.7.4\tgb\TorqueGameBuilder.exe"
start "Torsion" "D:\Program Files\Torsion\torsion.exe"

I got those paths from the respective Start Menu shortcuts and I'm sure they are right.

When I run the batch, Torsion launches normally. TGB, however, doesn't actually start: instead of showing the TGB window, an alert box comes up that says "Failed to open "main.cs," immediately followed by another alert that says "Failed to initialize game, shutting down."

When I launch it using the start menu shortcut it works just fine.

What's going on here?

#1
09/17/2009 (10:46 am)
Hi Pete,
this is because when you launch commands from a .bat the current directory is the directory where the .bat is contained and so "main.cs" file, needed to run TGB, is not found.

To solve this you can simply move the .bat file in your TGB directory ("D:\\Program Files\\GarageGames\\TorqueGameBuilder-1.7.4\\tgb") and shortcut from there to desktop.

Or, if you want to preserve clean the TGB directory, you can change directory inside the .bat file before launching TGB.

cd "D:\Program Files\GarageGames\TorqueGameBuilder-1.7.4\tgb"
start "TGB" "TorqueGameBuilder.exe" 
start "Torsion" "C:\Program Files\Torsion\torsion.exe"

Byez
#2
09/17/2009 (11:17 am)
Yeah, I thought it was probably a path issue, and your solution makes perfect sense... but it still doesn't work!

I checked the original shortcut, to see the "start in" path, and everything matches. It behaves exactly the same way as it did before though. Are we sure the right start path is the tgb folder? Where is main.cs exactly?
#3
09/18/2009 (6:43 pm)
Hi Pete,
it looks very strange to me that it is not working...did you tried to move the .bat file to TGB dir?
Anyway, the main.cs for TGB is exactly in the same directory of the .exe (in your case D:\Program Files\GarageGames\TorqueGameBuilder-1.7.4\tgb): if you can't find it there, then that's the problem! :-)
#4
09/19/2009 (7:24 am)
I moved it to the directory and now it works like a charm.

I'd like to satiate my curiosity about why changing directories didn't work, but I'd rather spend my time working on the game 8)