[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: os.execute with filename and argument containing spaces
- From: Thijs Schreijer <thijs@...>
- Date: Mon, 23 Jun 2014 06:55:22 +0000
> -----Original Message-----
> From: firstname.lastname@example.org [mailto:email@example.com] On
> Behalf Of Michael Gerbracht
> Sent: maandag 23 juni 2014 8:19
> To: firstname.lastname@example.org
> Subject: os.execute with filename and argument containing spaces
> I would like to use os.execute() to run an .exe file with a path as
> I tried the following:
> path = [["C:\program files\lua\lua.exe" "C:\Users\name surname\test.lua"]]
> I do get an error, that 'C:\Users\name' is not recogized as internal or
> external command.
There is some weird exception in the Windows command processor, in which case it removes the outer quotes. So only the inner quotes remain, and then it fails.
path = [[type NUL && "C:\program files\lua\lua.exe" "C:\Users\name surname\test.lua"]]
Then it no longer starts with a double quote and it should work fine.
See `cmd.exe /?` for some help on the exception.
> I know that you should put some quotes around the path if it contains
> And in my case both pathes used may contain spaces. If you put the content
> path variable into a .bat file it works. I expected that os.execute(command)
> does the same as putting the command in a .bat file but there seems to be a
> Do you have any idea how to get it working?
> P.S.: Please note that usually you need the excape sequence \\ for the \
> character in lua. When using [] brakets this seems not to be necessary,
> otherwise the print command would not show the desired output.
> Thank you very much!
> Michael Gerbracht