There are two problems in your code.
The first problem is that \f
is an escape character sequence in lists (for “go down one line”, IIRC; point is you don't want that interpretation). The second problem is that you've got your brace placement wrong in your foreach
.
The first problem is best addressed by using /
instead of \
, and then using file nativename
on the value fed to the OS. (You have to do that manually for argument to executables in expr
; Tcl can't fix that for you entirely automatically.) The second problem is just a syntax error.
Try this:
set top {C:/Users/file1.net C:/Users/file2.net}
set pspice D:/tools/bin/pspice.exe
foreach a $top {
# Tcl knows how to convert executable names for you; not the other args though
exec $pspice -r [file nativename $a]
}