2013-10-19 53 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

相關問題