batch files with the extension .cmd are not handled by exec
Closed3017997fffffffffffffffffffffffffffffffffCreated 16 years agoUpdated 2 years ago
Descriptionplain2010-06-18 11:42:37
In the clt newsgroup I wrote: we ran into a small issue with [exec] on Windows: In a DOS-box you can simply type a.cmd and the batch file is run. But [exec] gives the message: couldn't execute "a.cmd": no such file or directory [auto_execok a.cmd] simply returns "./a.cmd" and that gives the same message. You can run it by explicitly running it via cmd.exe: exec cmd.exe /c a.cmd It seems a bug (or perhaps better: an omission) in auto_execok. Batch files with the extension .bat are handled properly by [exec]
dkfplain2010-06-18 19:45:12
allow_comments - 1 Interesting, that means they must have not set the PATHEXT environment variable. .cmd now added to the default list on 8.5 and HEAD branches.
dkfplain2010-06-18 19:59:53
allow_comments - 0 Whoops! Wasn't aware that that was not enough. Needs a round of lookup through the registry. :-(
dkfplain2010-06-18 20:22:09
I've forgotten too much of the details.
homay2plain2013-02-22 17:07:51
Still exists in Tcl 8.6.0. Steps to reproduce: Create 2 files with the following contents: g:/lala.cmd: @start /wait cmd /c echo hello^&pause g:/lala.tcl: puts $env(PATHEXT); exec [auto_execok g:/lala] Run g:/lala.tcl. Result: .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC couldn't execute "g:\lala.CMD": no such file or directory ... Now rename g:/lala.cmd -> g:/lala.bat, and run g:/lala.tcl again. Result: the lala.bat batch runs as expected.
apnadkarniplain2025-01-26 06:49:55
Obsolete. Fixed in 8.6. Closing.
Log in (anonymous is fine) to add a comment.