lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 5/9/12, steve donovan <steve.j.donovan@gmail.com> wrote:
>> Neither %~f0 nor "%~f0" works correctly if filespec contains spaces.
>
> Ah, but we can always quote the argument - this version passes all
> tests (works from paths-with-spaces, correct errorlevel)
>
> ::lua::--[[
> @lua52.exe "%~f0" %* & @exit /b %errorlevel%
> ]]


Steve, this is a test that fails:

C:\Temp>type "my utils\hello.bat"
::lua::--[[
@lua52.exe "%~f0" %* & exit /b %errorlevel% ]]
print 'hello dolly'

C:\Temp>"my utils\hello.bat"
hello dolly

C:\Temp>"my utils\hello"
lua52.exe: cannot open C:\Temp\my utils\hello: No such file or directory


By the way, in the line
@lua52.exe "%~f0" %* & exit /b %errorlevel%
the %errorlevel% value is the value that was prior to calling lua52.exe.
This line should be splitted in two lines to get correct exit code.