Skip to main content
GameDev.net gamedev.net
🔒 Locked

old DOS batch script problem

Started by speciesUnknown Mar 30, 2009 at 3:22 PM 4 replies 1k views
Original Post
speciesUnknown
speciesUnknown
Im trying to use a batch script as a pre-build step for VS, when building my game. Here is the code I use to compile my level format: actopf cityscape_huge.ac cityscape actobr household_objects.ac household_objects actobr street_objects.ac street_objects actobr test_objects.ac test_objects Each of these is a seperate line in a .bat file. The problem is, whichever line I put first is the only line to execute, the interpreter executes them and then silently exits. I know that each of those executables (actopf and actobr) are correct and functioning, since any single line of this program runs as expected. Is there something I missed here?
Don't thank me, thank the moon's gravitation pull! Post in My Journal and help me to not procrastinate!
LessBread
LessBread
Inject some other commands in there and see what happens e.g. dir, cd, ipconfig.

"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
speciesUnknown
speciesUnknown
a helpful soul on #gamedev suggested this:

start actobr household_objects.ac household_objects
start actobr street_objects.ac street_objects
start actobr test_objects.ac test_objects
start actopf cityscape_huge.ac cityscape


which launches 4 instances of cmd.exe in the terminal emulator, which do not close. Somebody else suggested this:

start /b actobr household_objects.ac household_objects
start /b actobr street_objects.ac street_objects
start /b actobr test_objects.ac test_objects
start /b actopf cityscape_huge.ac cityscape


Which gives me nested instances of cmd.exe and powershell.exe.


Perhaps I should have stated at the start that im starting this script from powershell; I thought it would start an instance of cmd.exe when given a .bat file?
Don't thank me, thank the moon's gravitation pull! Post in My Journal and help me to not procrastinate!
speciesUnknown
speciesUnknown
Quote:
Original post by LessBread
Inject some other commands in there and see what happens e.g. dir, cd, ipconfig.


same result; first line executes, the rest is ignored.

If a built in command such as dir/ls, ipconfig, etc is uses, the interpreter will run up to the first of the original 4 lines. then, it will run that line and exit.
Don't thank me, thank the moon's gravitation pull! Post in My Journal and help me to not procrastinate!
LessBread
LessBread
Double-clicking a bat file on the desktop spawns cmd.exe.

I'm not familiar with powershell.

"start /?" provides info on cmd spawning.

"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
speciesUnknown
speciesUnknown
It works!

The problem was that actobr and actopf were not exes - they were .bat files themselves, which were pointing to exes of the same name. the solution was to change each line to cmd /s :


cmd /c actobr household_objects.ac household_objects
cmd /c actobr street_objects.ac street_objects
cmd /c actobr test_objects.ac test_objects
cmd /c actopf cityscape_huge.ac cityscape


The location of actopf.bat and actobr.bat was in a folder which I added to my $PATH, while the location of the exes they delegated to was in the build folder of my toolset projects.

I now remember my attempts to get symlinks to work, which met with failure (there is a forum post here somewhere)

Thanks for all your help.
Don't thank me, thank the moon's gravitation pull! Post in My Journal and help me to not procrastinate!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.