Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 59bc7fa31a21a559f2f7e4169eb8e70b74940f180cede35b69c6ad293f1a14d1
Ticket: f91ab723f3dfbc0d2b720a70a1fa09eebfa1cde5
exec+wish fails to handle windows batch file with arguments and spaces
User & Date: anonymous on 2024-02-22 21:36:06
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-fossil-plain"
  4. comment changed to:
    Reproduce the error with the following code run in wish console on Windows. Note that this works fine in tclsh:
    
    #Test4:
    set batFile {C:\batTest\bat test\test.bat}
    set arg1 {arg with spaces}
    set arg2 8
    set command [list $batFile $arg1 $arg2]
    exec {*}$command
    
    Output:
    'C:\batTest\bat' is not recognized as an internal or external command,
    operable program or batch file. 
    
    
    Where the bat file just outputs all arguments given:
    @echo off
    (for %%a in (%*) do (
        echo %%a
    )) 
    
    
    Proper output can be reproduced if the space if removed from the bat file path or the argument:
    
    (bin) 54 % #Test1:
    set batFile {C:\batTest\bat test\test.bat}
    set arg1 {argNoSpaces}
    set arg2 8
    set command [list $batFile $arg1 $arg2]
    exec {*}$command
    
    Output:
    argNoSpaces
    8 
    
    
    (bin) 64 % #Test3:
    set batFile {C:\batTest\test.bat}
    set arg1 {arg with spaces}
    set arg2 8
    set command [list $batFile $arg1 $arg2]
    exec {*}$command
    
    Output:
    "arg with spaces"
    8 
    
    I have tested this in an older version of tcl (8.5.9) and it works fine.
    
  5. foundin changed to: "8.6.13"
  6. is_private changed to: "0"
  7. login: "anonymous"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "21e0fa2b63977f4985a360a3d6914b25a98dd2d0"
  10. resolution changed to: "None"
  11. severity changed to: "Minor"
  12. status changed to: "Open"
  13. submitter changed to: "anonymous"
  14. subsystem changed to: "16. Commands A-H"
  15. title changed to:
    exec+wish fails to handle windows batch file with arguments and spaces
    
  16. type changed to: "Bug"