[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re:os.execute with filename and argument containing spaces
- From: 范祚至 <zuozhi_fan@...>
- Date: Mon, 23 Jun 2014 18:35:05 +0800 (CST)
This can work.
-- delete the last two quotes
path = [["C:\program files\lua\lua.exe" C:\Users\name surname\test.lua]]print(path)
But if you have more than one argument, I don't know how.
At 2014-06-23 02:19:04, "Michael Gerbracht" <email@example.com> wrote:
>I would like to use os.execute() to run an .exe file with a path as argument.
>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
>I know that you should put some quotes around the path if it contains spaces.
>And in my case both pathes used may contain spaces. If you put the content of
>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!