@echo off
rem This routine does not work if folder has an ampersand in its name

IF "%~1"=="" GOTO error
set tempfilename=temp-%RANDOM%
Set filename=%~1
echo.Filename is: %filename%

Set Folder=%~dp1
echo.Folder is: %Folder%
Set Name=%~nx1
echo.Name is: %Name%

rem Strip the extension
set Outname=%Name:~0,-4%.out
echo.Outname is: %Outname%

rem pause
luac53 -o "%Outname%" "%Name%"
pause
goto end

%~I         - expands %I removing any surrounding quotes (")
%~fI        - expands %I to a fully qualified path name
%~dI        - expands %I to a drive letter only
%~pI        - expands %I to a path only
%~nI        - expands %I to a file name only
%~xI        - expands %I to a file extension only
%~sI        - expanded path contains short names only
%~aI        - expands %I to file attributes of file
%~tI        - expands %I to date/time of file
%~zI        - expands %I to size of file

The modifiers can be combined to get compound results:
%~dpI       - expands %I to a drive letter and path only
%~nxI       - expands %I to a file name and extension only
%~fsI       - expands %I to a full path name with short names only
goto end
rem
:error
Echo You did not enter the input file name.
pause
:end