batch file scripting

Fayd

Diamond Member
Jun 28, 2001
7,970
2
76
www.manwhoring.com
okay, so i'm trying to call a bunch of batch files from within 1 batch file. they're scattered throughout another drive, and i want them to run as though i double-clicked them directly.

these batch files run a for loop, feeding a .avs to x264.exe to output a .264. this is all path sensitive.

anyways, when i run my master batch file

Code:
call "E:\Video\Video1\encode.bat"
call "E:\Video\Video2\encode.bat"
call "E:\Video\Video3\encode.bat"

it doesnt work, because it attempts to run all the called batch files on the folder the master batch file is in. i dont want that. i want to call them all to run in their respective folders, i just want them to run in order.
 

Fayd

Diamond Member
Jun 28, 2001
7,970
2
76
www.manwhoring.com
hmm... used cd to change the working directory before running each batch file.

it's working, but i wish there was a cleaner way to do it.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
That's how it's supposed to work. The only other work around is to use full paths in each of the scripts.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
i was hoping i could pass a parameter on the same line as 'call' that told it to use its directory as the working directory. no such luck i guess.

You mean some magic parameter to make call change directories for you or a parameter to your batch file to make it change directories? AFAIK the former doesn't exist but the latter is possible, although it would make the child scripts more complicated.
 

MerlinRML

Senior member
Sep 9, 2005
207
0
71
you could try doing something with the start command and specifying the run directory.

Code:
start /dE:\Video\Video1\ /wait encode.bat

With the wait flag, it should have a similar effect as doing a call. Just do the same thing for each batch file and modify the path and script name as appropriate.