Version 1 of Microsoft Windows and Tcl

Updated 2001-09-08 11:50:02

Purpose: to cover the use of Tcl under the variations of Microsoft Windows that continues to grow at an alarming rate.


See the latest FAQ [L1 ] for information being maintained by the comp.lang.tcl Windows and Tcl FAQ maintainer. Note that this version is different than the one posted to comp.lang.tcl - there has been some problems trying to get the autoposting software version updated :-( ...

See Microsoft Windows and Tk for information about the graphical extension and Windows.

Also, the Tcl Developers Xchange [L2 ] hosts a surprisingly (well, it surprises CL) active Web forum on Win* issues [L3 ]

Other info will be added as people encounter it.

For instance, Tcl runs on Windows 95/98/Windows NT, Windows 2000, and soon Windows/CE.


A frequent problem in DOS/Windows vs. C/Tcl is the use of backslashes as path separators. Tcl parses c:\test to have a Tab (\t) as third character, with "est" following that. Since strings may get parsed several times, the safest is to use slashes internally. You can get that canonical form from a backslashed pathname with

 set canonicalpathname [file join $backslashedpathname]

Going back to backslashes may be necessary for exec:

 set backslashedpathname [file nativename $canonicalpathname];#RS

A recent question and answer from comp.lang.tcl asks:

What options are available for printing from a TCL (not TK) script running under Windows (NT/9x/2000)?

One way is to just open and write directly to a device like LPT1.

   set pr [open lpt1 w]

If the printer isn't attached to the local PC, you will need to capture the device to the network queue. One way to do this is with a command-line like:

  net use lpt1 \\server\printer /persistent:yes


A topic that's sure to come up more and more often is "What WinForms has to do with Tcl".


A frequent, sometimes implicit, topic is "How Tcl accesses the Win32 API". Also important for getting the right Windows feel is to "Register file types under Windows".


Windows specific Tcl commands - Arts and crafts of Tcl-Tk programming