lamuzz...@gmail.com <
lamuzz...@gmail.com> wrote:
> El sábado, 22 de octubre de 2022 a la(s) 10:00:35 UTC-3, Rich escribió:
>>
> I started with the simplest, passing the program and its arguments to
> the exec.
> However, I was getting an error as if argument string was truncated
> (does exec have any length restrictions?).
exec the Tcl command may not, but the underlying OS most likely does.
Presumably, given a "bat" file, you are on windows?
> This is not a program problem because when run as a batch it works ok.
> So I tried using exec with the batch file.
> But if I redirect the output of the batch file using the exec options
> (2>@1) what I get is the command line that is executed within the
> batch, not the output of the program.
> That's why I thought I'd send the windows option as a parameter.
For a batch file, on windows, to 'exec' it you likely also have to
invoke the command interpreter. You may want to do this:
exec {*}[auto_execok mycommand.bat] ...
auto_execok is another Tcl command that will return the necessary
'magic' to properly launch "mycommand.bat". Replace ... with the rest
of the parameters you'd otherwise pass along.