The NEW Build Your Own Arcade Controls

Main => Main Forum => Topic started by: lllll44 on October 05, 2020, 10:41:16 am

Title: Better bath script to start a mame game
Post by: lllll44 on October 05, 2020, 10:41:16 am
hi,
i use this script for mame games:

@echo off

Type :
d:
cd \
cd emulators
cd mame
mameui64.exe roms\alien3.zip

exit

is there a shorter/better way to start a mame game?
Title: Re: Better bath script to start a mame game
Post by: Drnick on October 05, 2020, 10:55:18 am
I'm betting that you have tried rolling it all together to get d:\emulators\mame\mameui64.exe roms\alien3.zip and it failed,  I believe the reason for this is it does not know where the INI file is located without being in relative path,  thus using d:\ cd\ cd emulators etc puts the system in the right relative folder.   Try adjusting the command line to something like this.

d:\Emulators\mame\mameui64.exe"-inipath d:\Emulators\mame\" d:\Emulators\mame\roms\alien3.z

Is it shorter, No, Is it easier to script, possibly :) :) :)


Title: Re: Better bath script to start a mame game
Post by: lllll44 on October 05, 2020, 12:58:36 pm
thank you. will try:)
Title: Re: Better bath script to start a mame game
Post by: nexusmtz on October 06, 2020, 12:21:34 am
pushd d:\emulators\mame
mameui64.exe alien3

(as long as d:\emulators\mame\mame.ini includes "rompath roms")
Title: Re: Better bath script to start a mame game
Post by: lllll44 on October 08, 2020, 09:12:00 am
pushd d:\emulators\mame
mameui64.exe alien3

(as long as d:\emulators\mame\mame.ini includes "rompath roms")

thanks man...works great.
but why its "pushd" and not "start?"
Title: Re: Better bath script to start a mame game
Post by: nexusmtz on October 08, 2020, 11:24:01 pm
pushd changes the drive and current directory at the same time.

pushd also tells the command processor to remember where you were, so you can popd back later.

ex:
C:\>pushd u:\games\mame0219b_64bit
u:\games\mame0219b_64bit>mame64 dkong
u:\games\mame0219b_64bit>popd
C:\>

The command processor memorizes c:\ (pushes it onto a stack) before it switches to u:\games\mame0219b_64bit, then it recalls c:\ (pops it off the stack) when you say popd.

You don't need to use popd in your case, because you're ending the batch file anyway, so it doesn't matter where you end up.

"Start" is used when you want the command processor to run a command with specific options in a new instance of the command processor. One option (/D) is the starting directory. You certainly could use Start instead of Pushd, and do it all with one command, but there's little reason to kick off another command processor when all you wanted to do was set the working directory. Anyway, that would be:

start /d d:\emulators\mame /min /wait mameui64.exe alien3
Title: Re: Better bath script to start a mame game
Post by: Drnick on October 10, 2020, 10:35:56 am
pushd changes the drive and current directory at the same time.

pushd also tells the command processor to remember where you were, so you can popd back later.

ex:
C:\>pushd u:\games\mame0219b_64bit
u:\games\mame0219b_64bit>mame64 dkong
u:\games\mame0219b_64bit>popd
C:\>

The command processor memorizes c:\ (pushes it onto a stack) before it switches to u:\games\mame0219b_64bit, then it recalls c:\ (pops it off the stack) when you say popd.

You don't need to use popd in your case, because you're ending the batch file anyway, so it doesn't matter where you end up.

"Start" is used when you want the command processor to run a command with specific options in a new instance of the command processor. One option (/D) is the starting directory. You certainly could use Start instead of Pushd, and do it all with one command, but there's little reason to kick off another command processor when all you wanted to do was set the working directory. Anyway, that would be:

start /d d:\emulators\mame /min /wait mameui64.exe alien3

Why am I just now learning about Pushd :) :) :) I'm going to be using that one in the future.  So so many Powershell commands I have yet to learn :)