Fancy batching?

Soldato
Joined
2 Jun 2007
Posts
6,839
Location
Mornington Crescent
Right, I play an online game that uses a launcher. The graphics are stored in the /img directory in the game folder. There are lots of downloadable launchers that use different graphics, and I like several of them.

Is there some batch command I could use or something that would randomly select a folder to use, and rename it to 'img' so the game loads that launcher graphics, then when the game is closed, changes the name back to something else?


Assuming I've not made myself clear, here's a pictue to help.
http://img235.imageshack.us/img235/7690/imgez4.jpg

In the game folder, there is the img folder that the launcher graphics load from. And there are 5 other folders with img in their name, each having the graphics for a different launcher. Is there some way of randomly changing which launcher graphics are used, or something?

Thanks in advance.
 
i dont know about random selection but you could create a menu in a script to choose the launcher you want.

It would give an out put like
Code:
press the corisponding number

1. launcher 1
2. launcher 2
3. launcher 3

simple and reasonably easy to do.
 
ren "D:\program files\etc\Gunbound\DN img" "D:\program files\etc\Gunbound\img"
path to exe..
ren "D:\program files\etc\Gunbound\img" "D:\program files\etc\Gunbound\DN img"


something like that -when the exe is closed, it'll rename the folder to DN img

do it in a test environment first
 
Thanks, I've managed that partly - I've renamed all the folders to remove the " img" from their name. Then made a .bat command with the following:

Code:
rename DN img
"D:\Program Files\Softnyx Canada\GunBound Classic\GunBound.exe"
rename img DN

I run this while not having a folder called img, and it renames the DN folder and the launcher starts fine, and I can login. However, it doesn't rename the folder back to img after. I'm guessing this may be because the folder is still in use when it tries to rename it?
Also, while this is a step in the right direction, is there any way to make it randomly select one of the folders to rename (As long as it doesn't try to rename one of the game folders). What about creating one batch file to rename each folder, then a seperate batch file that randomly runs one of those?
 
Well, in case anyone is wondering/cares, I've pretty much got it sorted.

Code:
copy tach img
"D:\Program Files\Softnyx Canada\GunBound Classic\GunBound.exe"
pause
del "D:\Program Files\Softnyx Canada\GunBound Classic\img" /q /f

One batch file as above for each launcher folder. And each batch file should be named from 0-9
Code:
"D:\Program Files\Softnyx Canada\GunBound Classic\%random:~-1%.bat
That creates a random number from 0-9 then runs the batch file with that name :D

Its still a bit annoying that I have to use the pause command, but if I just delete the contents of the /img folder straight away, then it just doesn't work.
 
If you use start /wait before the Exe you want to run you will not need the pause

so it would look like this
Code:
 copy tach img
start /wait "d:\program files\softnyx canada\gunbound classic\gunbound.exe"
del "folder name"

it would be quicker and cleaner to use rename insted of copy and delete for each folder.

And if you do a google for cmdow.exe you can completely hide the batch script windows from view when they are running.

example number 2
Code:
@cmdow.exe @ /hid
cd \
d:
cd "program files\softnyx canada\gunbound classic"
ren tach img
start /wait gunbound.exe
ren img tach
quit

more code but cleaner running and with less chance of screwing up
i can get more technical if you want using "if exist" or "if not exist" to tell you if the img folder exists already or not.
 
Last edited:
Thanks.
I was planning on changing it to a rename command later this evening. I used to have it as one, but I was still having the problem of it not renaming it after because the files were still in use. However, deleting it didn't work either, and I never got around to changing it back.

I'll try out that wait command, though what does it actually do? I'm not sure if it will work, since the gunbound.exe launches the game through the file gbc.yiff. Gunbound.exe then closes, but a couple of the files in the launcher folder stay in use untill the program is closed.
edit: Also just realised. Which the cmdow would be very handy, its not that much use if you need to press any key on the command prompt, only for there to be no window :P
 
Last edited:
the "Start /wait" will wait for the program to completely exit before allowing the next process to complete. I use it all the time in this sort of scripting for things like stalker and bf2
 
Just tried that. However, as I said, gunbound.exe launches gbc.yiff then closes as soon as you enter your password. So the wait command doesn't work, since gunbound.exe closes, but gbc.yiff is still accessing some of the files in the /img folder.

Flow chart thingy of what happens:
1. run the bat
2. renames tach to img
3. Runs gunbound.exe, which loads the graphics from the /img folder
4. Enter password
5. gunbound.exe launches gbc.yiff
6. gbc.yiff accesses files from the /img folder
7. gunbound.exe closes
8. bat file tries to rename img folder, can't since its still being used.
 
there is a way to query the memory and see if a process is still running and there is also a wait program that you can download (search google) only trouble is i cannot remember how to do it. Its along the lines of the If exist statement and it works on the pid of the process. you could use this and the wait command to periodicaly check the memory for the process and once you have quit the game it would rename the folder again.

I know for sure it can be done with VB but i dont have the time or energy to start that :( sorry
 
No, sorry. Its working using the pause. Wait isn't any good since gunbound.exe ends while the files in /img are being accessed, so the rename fails.
 
Back
Top Bottom