开发者

String path with spaces in TCL not working

开发者 https://www.devze.com 2023-04-03 16:52 出处:网络
Why can\'t i do this in TCL: set path \"|C:/Program Files/Example/My Program/prgrm.exe\" The string path will get the value:

Why can't i do this in TCL:

set path "|C:/Program Files/Example/My Program/prgrm.exe"

The string path will get the value:

"C:/Program".

But if I remove the space开发者_开发百科s it will get the full path... Anyone got an idea?


It's because the code for running a subprocess with pipe takes a Tcl list after the | character. Build and run it like this:

set path "C:/Program Files/Example/My Program/prgrm.exe"
set pipe [open |[list $path]]

(Later items in that list are the arguments to pass to prgrm.exe.)

0

精彩评论

暂无评论...
验证码 换一张
取 消