6 -- Lua 5.2 module providing a simple API for invoking system services
7 -- via the Microsoft Windows Scripting Host.
10 -- This file is a component of mingw-get.
12 -- Written by Keith Marshall <keithmarshall@users.sourceforge.net>
13 -- Copyright (C) 2012, MinGW Project
16 -- Permission is hereby granted, free of charge, to any person obtaining a
17 -- copy of this software and associated documentation files (the "Software"),
18 -- to deal in the Software without restriction, including without limitation
19 -- the rights to use, copy, modify, merge, publish, distribute, sublicense,
20 -- and/or sell copies of the Software, and to permit persons to whom the
21 -- Software is furnished to do so, subject to the following conditions:
23 -- The above copyright notice and this permission notice shall be included
24 -- in all copies or substantial portions of the Software.
26 -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
27 -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28 -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
29 -- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30 -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
31 -- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
32 -- DEALINGS IN THE SOFTWARE.
35 local cscript = "cscript -nologo"
37 function M.execute( ... )
38 local function wsh_prepare( interpreter, ... )
39 for argind, argval in ipairs {...}
41 interpreter = interpreter .. " " .. argval
45 os.execute( wsh_prepare( cscript, ... ) )
48 function M.libexec_path( script, subsystem )
49 local script_path = os.getenv( "APPROOT" )
52 script_path = script_path .. "libexec\\"
54 script_path = ".\\libexec\\"
58 script_path = script_path .. subsystem .. "\\"
60 return script_path .. script
65 -- $RCSfile$: end of file */