2013-10-19 50 views
0

上下文Exec中的命令行二进制文件:Windows 7中的ActiveState Tcl的8.6.1不明白为什么我不能在tclsh的

% info tclversion 
8.6 
% info patchlevel 
8.6.1 

我有一个名为SETCFG.EXE一个C#控制台模式的应用程序。它位于C:\ BIN中的路径上。

% set project corp 
corp 
% set method Recent 
Recent 
% exec -- [list c:/bin/setcfg.exe bobat.cfg inserter.${project}.Method $method] 
couldn't execute "c:\bin\setcfg.exe bobat.cfg inserter.corp.Method Recent": no such file or directory 

现在它可以说,我不是正确,指定TCL代码 - 它已经从上次的遭遇多年 - 所以我会尽力execing字符串

% exec -- "c:/bin/setcfg.exe bobat.cfg inserter.${project}.Method $method" 
couldn't execute "c:\bin\setcfg.exe bobat.cfg inserter.corp.Method Recent": no such file or directory 

嗯...也许我需要把程序第一和参数第二...

% exec -- "c:/bin/setcfg.exe" "bobat.cfg inserter.${project}.Method $method" 
Syntax: 
     c:\bin\setcfg.exe cfg sym val 
child process exited abnormally 

参数列表?

% exec -- "c:/bin/setcfg.exe" [list bobat.cfg inserter.${project}.Method $method] 
Syntax: 
     c:\bin\setcfg.exe cfg sym val 
child process exited abnormally 

那么我没有做对吗?我尝试了一些可能性。还有更多吗?

回答

3

您需要指定多个参数为exec,而不是一个参数。你想要

exec -- c:/bin/setcfg.exe bobat.cfg inserter.${project}.Method $method 

有时候,你会看到构建命令的代码作为列表。在这种情况下,您将使用“splat”运算符将列表展开为单个元素。

set command [list c:/bin/setcfg.exe bobat.cfg inserter.${project}.Method $method] 
exec -- {*}$command 

exec man pageTcl syntax page

相关问题