lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Jeff Pohlmeyer wrote:
On Tue, Nov 2, 2010 at 2:39 AM, Lorenzo Donati wrote:

Is there a simple way (stock Lua 5.1.4) to make a Lua script behave
differently depending on whether it is executed in a MSWindows shell or not?
I hope someone has found a clever trick that can solve my problem. :-)


I'm not on Windows right now, but does os.getenv("CMDCMDLINE") look
any different between scite vs. console?

 - Jeff



Mmmh, just tried.
It looks different when typed directly on the command line:

echo %CMDCMDLINE%
--> cmd  /K  ansicon -p

but inside a Lua script:

print (os.getenv("CMDCMDLINE"))	--> nil

regardless of whether it is run inside scite or from a Windows XP shell.

-- Lor