lua-users home
lua-l archive

Calling a batch file from within LUA

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


That would work if i the folder names were always going to be c:\folder1 and c:\folder2!
The folder names will be decided at run time by the lua script so they will have to be held in two variables.
E.g. Argument1 & Argumnet2
So for example Argument1 = c:\folder1
 Argument2 = c:\folder2
So calling execute[[ batch Argument1 Argumnet2 ]]
would pass the actual string='Argument1' to the batch file rather that the path held by the varialbe Argument1
So you execute(batch Argument1 Argument2)
work?
Thanks for your time
Brian
>brian@arandasys.com wrote:
>> execute("batch c:\folder1 c:\folder2")
>> 
>> batch being the name of the batch file to execute
>and c:\folder1 & c:\folder2 being the two arguments
>passed.
>> 
>> Is this the correct/best way to do this?
>
>The backslashs within the double quotes are going
>to get you.
>It's better to use [[ ... ]] to quote string
>containing DOS path names.
>
>Lua 4: execute[[ batch c:\folder1 c:\folder2 ]]
>Lua 5: os.execute[[ batch c:\folder1 c:\folder2 ]]
>
>
>- Peter Shook

AltStyle によって変換されたページ (->オリジナル) /