1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

What does this error means: TCC: Unknown command "C:\Program"

Discussion in 'TCC/LE Support' started by georgearoush, Aug 20, 2009.

  1. georgearoush

    Joined:
    Aug 20, 2009
    Messages:
    5
    Likes Received:
    0
    Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
    <o:p></o:p>
    My version of TCC is: "TCC 9.00.103 Windows XP [Version 5.1.2600]"<o:p></o:p>
    <o:p></o:p>
    The problem that I'm having is this: when I try to execute some programs from within TCC shell, I get this error: "TCC: Unknown command "C:\Program"" One of the programs that gives me this error is Rational's ClearCase, cleartool.exe. It works fine when I execute it from plain old Windows CMD.<o:p></o:p>

    Can you tell me how I can figure out what's the issue and fix it?<o:p></o:p>

    <o:p></o:p>
    Thanks.<o:p></o:p>
    <o:p></o:p>
    -- George<o:p></o:p>
    <o:p> </o:p>
     
  2. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,277
    Likes Received:
    38
    Re: What does this error means: TCC: Unknown command &quot;C:\Program&quot;

    If you type SET COMSPEC at the prompt, what do you see?
     
  3. georgearoush

    Joined:
    Aug 20, 2009
    Messages:
    5
    Likes Received:
    0
    Here is what I get:

    [C:\]set COMSPEC
    C:\TOOLS\TCMD9\tcc.exe

     
  4. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,277
    Likes Received:
    38
    Re: What does this error means: TCC: Unknown command &quot;C:\Program&quot;

    Well, that's obviously not it. (As I should have known from the error message; it's a TCC message, so TCC.EXE is being started.)

    I wonder if something is maybe passing TCC a bad command tail. Perhaps trying to start something under "C:\Program Files", but not correctly quoting the filename. One thing you might try is adding a line DEBUG=3 to your TCC.INI file, underneath the [4NT] section header. That directive will cause TCC to display its command tail every time it's started, which might be helpful in tracking down the problem.

    Another thing you might try is temporarily changing the COMSPEC variable to point to CMD.EXE, and seeing whether that prevents the problem:

    Code:
    set comspec=%windir\system32\cmd.exe
     
  5. georgearoush

    Joined:
    Aug 20, 2009
    Messages:
    5
    Likes Received:
    0
    Changing the comspec to Windows's cmd.exe fixed the problem -- but this is not a solution, just a confirmation.

    Adding "DEBUG=3", here is what I get:

    When I restarted TCC:
    TCC tail is: ["C:\TOOLS\TCMD9\TCC.EXE"]
    Press any key to continue ...

    When I execute my program:
    [R:\project.src\tools]ct lsvtree -g test.exe
    TCC tail is: [C:\TOOLS\TCMD9\tcc.exe /c "C:\Program Files\IBM\RationalSDLC\ClearCase\bin\clearvtree" "test.exe"]
    Press any key to continue ...
    TCC: Unknown command "C:\Program"

    Now, the following works (this is invoking "clearvtree" directly while "ct lsvtree -g test.exe" seems to be spwaning "clearvtree" ):
    [R:\project.src\tools]clearvtree test.exe

    Let me know what else I can try.
     
  6. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,277
    Likes Received:
    38
    Re: What does this error means: TCC: Unknown command &quot;C:\Program&quot;

    Well, I'm confused. It still looks to me like an unquoted argument, but the command tail shows everything properly quoted. Odd.

    What is CT -- an executable, a batch file, an alias? ( WHICH TC should tell you.) Do you have a TCSTART.BTM which references the %1, %2 etc. parameters?

    Changing COMSPEC may be a reasonable workaround. As far as I know, TCC never uses it. It's just there for programs which spawn subsidiary command shells -- and such programs are likely to expect CMD.EXE anyway. You could add a SET to your TCSTART file to set it more-or-less permanently. Or, you might use an alias to change it on-the-fly for just that one command:

    Code:
    alias ct=`set comspec=%windir\system32\cmd.exe & *ct & set comspec=%_cmdspec`
    Sorry, without a better understanding of what's going on, that's about the best I can come up with....
     
  7. georgearoush

    Joined:
    Aug 20, 2009
    Messages:
    5
    Likes Received:
    0
    "ct" is a batch script, here is it's content:

    Code:
    @echo off
    REM redirect ct to cleartool
    setlocal
    cleartool %*
    if errorlevel 1 goto cleartool_failed_so_exit_with_non_zero_val 2>nul
    endlocal
    
    If I call "cleartool" directly, I get the same error:

    Code:
    [R:\project.src\tools]cleartool lsvtree -g test.exe
    TCC tail is:  [C:\TOOLS\TCMD9\tcc.exe /c "C:\Program Files\IBM\RationalSDLC\ClearCase\bin\clearvtree" "test.exe"]
    Press any key to continue ...
    TCC: Unknown command "C:\Program"
    
    If you need anything more data or want me to try anything else to help narrow down this issue, I be glad to do so.

    Using the workaround that you suggested, do I lose any TCC features?
     
  8. georgearoush

    Joined:
    Aug 20, 2009
    Messages:
    5
    Likes Received:
    0
    I'm trying the workaround; where do I find "TCSTART" to set COMSPEC?

    There is an option to set COMPEC from TC's GUI properties, when I did so, I lost all of my TC goodies.

     
  9. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    georgearoush wrote:
    | "ct" is a batch script, here is it's content:
    |
    |
    | Code:
    | ---------
    | @echo off
    | REM redirect ct to cleartool
    | setlocal
    | cleartool %*
    | if errorlevel 1 goto cleartool_failed_so_exit_with_non_zero_val 2>nul
    | endlocal
    | ---------
    |
    | If I call "cleartool" directly, I get the same error:
    |
    |
    | Code:
    | ---------
    | [R:\project.src\tools]cleartool lsvtree -g test.exe
    | TCC tail is: [C:\TOOLS\TCMD9\tcc.exe /c "C:\Program
    | Files\IBM\RationalSDLC\ClearCase\bin\clearvtree" "test.exe"] Press
    | any key to continue ...
    | TCC: Unknown command "C:\Program"
    | ---------
    |
    | If you need anything more data or want me to try anything else to
    | help narrow down this issue, I be glad to do so.
    |
    | Using the workaround that you suggested, do I lose any TCC features?

    It appears CLEARTOOL.EXE spawns a new instance of the command processor
    ("shell") to execute CLEARVTREE, instead of doing it directly, and passes
    the program name incorrectly: it is quoted, indicating that no further
    interpretation is needed, but the file extension (presumably .exe) is
    missing.

    IIRC the workaround that had been suggested is to change the COMSPEC
    environment variable to CMD, not TCC, before CT.BAT is executed. Since
    COMSPEC is used only by moderately well behaving programs (i.e., not
    hardcoded for CMD.EXE, but expecting its exact syntax), it will be used only
    when CLEARTOOL wants to pass a command to the shell. Since CLEARTOOL expects
    CMD, no TCC features are required, and so no features are lost. You should
    probably write a small .BTM file to make the COMSPEC change temporary,
    before CT is invoked.

    REX:
    ----
    It seems CMD.EXE can receive a quoted, fully qualified but incomplete
    filename, i.e., one with path but without extension, as the command to be
    executed, and make the usual "path extension" search, thus locating the
    program file. Do you think this "feature" ought to be emulated in TCC for
    those migrating from CMD?
    --
    Steve
     
  10. samintz

    samintz Scott Mintz

    Joined:
    May 20, 2008
    Messages:
    1,177
    Likes Received:
    11
    I can verify what George is seeing.

    This command line generates the error:
    C:\4nt10\TCC.EXE /c "C:\Program Files\Rational\ClearCase\bin\clearvtree"
    "mk.cmd"

    This one succeeds:
    C:\4nt10\TCC.EXE /c "C:\Program
    Files\Rational\ClearCase\bin\clearvtree.exe" "mk.cmd"

    And the command line without the leading tcc.exe /c also succeeds:
    "C:\Program Files\Rational\ClearCase\bin\clearvtree" "mk.cmd"

    I don't understand George's comment about losing TC goodies however. I
    routinely set ComSpec to CMD.EXE and I haven't had any issues with TC
    features not working.

    -Scott


    georgearoush <> wrote on 08/21/2009 10:31:31 AM:


    comspec=%_cmdspec`

     
  11. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    georgearoush wrote:
    | I'm trying the workaround; where do I find "TCSTART" to set COMSPEC?

    There is no TCSTART by default. You must create it explicitly. It must be in
    the same directory as TCC.EXE itself, or in the directory which you can
    explicitly specify using the GUI properties dialog invoked by the OPTION
    command (the method I use).

    | There is an option to set COMPEC from TC's GUI properties, when I
    | did so, I lost all of my TC goodies.

    By "GUI Properties", do you mean the GUI pop-ups activated by the TCC
    internal command OPTION, or by using the "Properties" pop-up in Windows
    Explorer? In neither one did I find a method to set COMSPEC.

    I feel that you should set COMSPEC only while executing the CT.BAT batch
    file. The CT alias in the quote below does that. An alternate is a batch
    file, e.g.:

    @echo off
    setlocal
    set comspec=%windir\\system32\cmd.exe
    ct.bat %$

    Alias method:
    || Code:
    || ---------
    || alias ct=`set comspec=%windir\system32\cmd.exe & *ct %$ & set
    comspec=%_cmdspec`
    || ---------

    Note: I added "%$" to "*ct" in the alias.
    --
    HTH, Steve
     
  12. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,277
    Likes Received:
    38
    Re: What does this error means: TCC: Unknown command &quot;C:\Program&quot;

    Okay, new suggestion. Create a new batch file named CT.BTM, in the same location as your existing CT.BAT:

    Code:
    @echo off
    rem   CT.BTM:  redirect CT to ClearTool
    setlocal
    set comspec=%windir\system32\cmd.exe
    cleartool %*
    quit %?
    
    TCC looks for .BTM files before .BAT, so it will use the new batch file instead of the old one. CMD.EXE doesn't look for .BTM files at all, so it won't be affected. And since the change to COMSPEC happens inside a SETLOCAL / ENDLOCAL block, it will automatically disappear when the batch file ends.

    (And you can remove the DEBUG line from your .INI file; I'm sure it must be annoying you by now....)
     
  13. jjdstr

    Joined:
    Aug 24, 2009
    Messages:
    1
    Likes Received:
    0
    I am also encountering the same problem and would like to add the following report:

    • This command line generates the error:
      C:\TC\TCC.EXE /c "C:\Program Files\Rational\ClearCase\bin\clearvtree" "mk.cmd"
    • This one succeeds:
      C:\TC\TCC.EXE /c "C:\Program Files\Rational\ClearCase\bin\clearvtree" mk.cmd
    So it seems that for some reason the extra quotes are affecting TCC ability to parse the command too.

    I also tried configuring the PATHEXT option (thought it might have something to do with it) but it does not seem to help.
     
  14. jjensen

    Joined:
    Oct 13, 2009
    Messages:
    10
    Likes Received:
    0
    That's interesting. In TCC/LE 10.00.71, this was working fine. As of 10.00.76, this no longer works.

    It is easy to reproduce. TCC/LE falls over when called from the Visual C++ runtime system() function when installed to the standard Program Files location.

    Josh
     

Share This Page