[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: bug regarding os.execute?
- From: "Robert Raschke" <rtrlists@...>
- Date: Mon, 21 Jul 2008 09:55:07 +0100
On 7/21/08, Xu Wang <email@example.com> wrote:
> Dear lua list,
> See below for a test:
> Lua 5.1.2 Copyright (C) 1994-2007 Lua.org, PUC-Rio
> > cmd1=[["C:\Program Files\TortoiseSVN\bin\subwcrev" .\ "addnb.v29.ace" "D:\ace\addnb.v29.ace"]]
> > os.execute(cmd1)
> 'C:\Program' is not recognized as an internal or external command,
> operable program or batch file.
> > cmd2=[["C:\Program Files\TortoiseSVN\bin\subwcrev" .\ addnb.v29.ace D:\ace\addnb.v29.ace]]
> > os.execute(cmd2)
> SubWCRev: 'D:\wangxu\WorkData\Kuwait_USR6_USR6.1\movie\'
> Last committed at revision 18
> Mixed revision range 17:18
> cmd1 is error but cmd2 can be executed sucessfully. why?
Windows is very peculiar when it comes to quoting command lines. Try
"help cmd" in a command window to get into details.
The "proper" way to give a command line to os.execute() on Windows is
to double-quote each of the program name and all its arguments, and
then wrap double-quotes around the whole thing. For example:
cmd = [["C:\Program Files\TortoiseSVN\bin\subwcrev" ".\"
os.execute([["]] .. cmd .. [["]])