Well, I made a MAME launcher for RMXP a while back, and the syntax was quite simple. I used the following code to launch MAME from a subfolder (named MAME, of course), as though I had double-clicked it, and then close the game.
system("START MAME\\mame.exe")
exit
Please note that in that string, after the line calling the executable, you can actually add calls like you would in the command prompt. I used these to launch the game I wanted, with the settings I preferred. (For example, I used it to launch an FPS so that it would track the mouse as the gun, instead of using the arrow keys) The system command actually executes code as though it was a .bat file (mostly). The exit line actually served to close the game, as it would imply.