Luaox
Luaox

Reputation: 167

& in os.execute

os.execute("start http://test.aspx?arg1=one&arg2=two")

I get this error:

'arg2' is not recognized as an internal or external command, operable program or batch file.

How to fix that?

Upvotes: 0

Views: 1670

Answers (2)

hjpotter92
hjpotter92

Reputation: 80647

In shell languages, & and ; act as command separator. You need to enclose the command inside double-quotes for it to work..

os.execute("start \"http://test.aspx?arg1=one&arg2=two\"")

Or more simply:

os.execute([[start "http://test.aspx?arg1=one&arg2=two"]])

Upvotes: 2

Egor Skriptunoff
Egor Skriptunoff

Reputation: 23767

Windows interprets & as command separator

os.execute'start "http://test.aspx?arg1=one&arg2=two"'

Upvotes: 2

Related Questions