@pieter - I tried both %ITEM_NAME% and %ITEM_FILEPATH% with and without quotes however this doesn't work.
@dustind900 - I'm not sure how I would go about adding the code to my AHK script. The script it designed to exit mame when I hold button9 on my gamepad for 2 seconds. I've pasted the code for the script below:
Joy9::
KeyWait,Joy9,T2 ;wait 2 seconds for release key
If (ErrorLevel) ;more than 2 sec have passed
{
Process, Close, mame64.exe
Exitapp
}
Return
I'd like to add that running the .bat file manually from the command prompt (i.e. start command prompt, mame64.bat gamename) works ok but it doesn't when enacted from RetroFE.