问题
I am running Lua on a Windows 7 machine and I am trying to launch a LabVIEW executable using Lua.
This is an example of the command line input that DOES work:

The text I use:
"C:\Program Files\National Instruments\LabVIEW 2009\LabVIEW.exe" "C:\Program Files\National Instruments\LabVIEW 2009\examples\viserver\cmdline.llb\CommandLine.vi" -- 4.0
However no matter how I try to format this in Lua, it complains:
'C:\Program' is not recognized as an internal or external command, operable program or batch file.
I currently have it formatted as the following with no success:
local s = [["C:\Program Files\National Instruments\LabVIEW 2009\LabVIEW.exe" "C:\Program Files\National Instruments\LabVIEW 2009\examples\viserver\cmdline.llb\CommandLine.vi" -- 4.0]]
os.execute(s)
I need help formatting that local string s
to do the same as what I typed into the command prompt.
回答1:
Some quick reading online suggests that you might need to wrap your command string in an extra set of quotes. Like this I think:
[[""C:\Program Files\National Instruments\LabVIEW 2009\LabVIEW.exe" "C:\Program Files\National Instruments\LabVIEW 2009\examples\viserver\cmdline.llb\CommandLine.vi" -- 4.0"]]
来源:https://stackoverflow.com/questions/21263291/lua-os-execute-with-command-line-arguments