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

Use extension other than .btm

Discussion in 'Support' started by grimblefritz, Jul 1, 2009.

  1. grimblefritz

    Joined:
    Feb 25, 2009
    Messages:
    16
    Likes Received:
    0
    I want to be able to execute BTM files, but with an extension of .tc instead of .btm, under XP/Vista.

    I tried associating the ".tc" with "%COMSPEC /i /d /c", but I get an endless loop of tcc subshells, never any output from the script. Yes, the script works fine as a .btm, just to intercept that question :-)

    I also tried the "set .tc=%COMSPEC" method, same result.

    Without either of the two above, Windows will prompt me to find the program needed to execute .tc files.

    Any ideas?
     
  2. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    grimblefritz wrote:
    | I want to be able to execute BTM files, but with an extension of .tc
    | instead of .btm, under XP/Vista.

    Cannot be done. The only acceptable extensions are .BAT (emulating
    COMMAND.COM), .CMD (emulating CMD.EXE), and .BTM (native mode).
    --
    Steve
     
  3. Jim Cook

    Joined:
    May 20, 2008
    Messages:
    605
    Likes Received:
    0
    The only way I can think of just now is to do something very
    unconventional and surely not worth the effort.

    It amounts to automatically renaming the .TC file to .BTM, executing
    it, and renaming it back.

    .) SET .TC to a program name that does not exist and is instantly
    recognizable as being from the .TC executable extension.

    .) Set the UNKNOWN_CMD alias to test for the program name from the .TC
    variable. Use something like %@if[%1==recognizable,RunAsBtm %$,echo
    Unknown command %$].

    .) Make a RunAsBtm alias or batch that renames its first parameter,
    runs it, and renames it back.


    On Wed, Jul 1, 2009 at 7:50 AM, grimblefritz<> wrote:



    --
    Jim Cook
    2009 Saturdays: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
    Next year they're Sunday.
     
  4. grimblefritz

    Joined:
    Feb 25, 2009
    Messages:
    16
    Likes Received:
    0
    Yeah, I gathered that. Too bad. Sometimes limitations are, well, limiting :-)

    There needs to be a startup option that tells tcc to use the supplied file as a BTM, regardless of extension. Something like:

    Code:
    tcc.exe /b filename.anyext
    And since the wishing well is open, it would be VERY nice if tcc could accept a BTM on stdin (borrowing an *nix convention of - representing stdin/stdout in lieu of a filename):

    Code:
    tcc.exe /b -
    This would open the door to a few more *nix-like possibilities.

    In the meantime...

    Code:
    c:> set .tc=c:\bin\tcrun.btm
     
    c:> type c:\bin\tcrun.btm
    @echo off
    set run=%@unique[c:\windows\temp]
    ren /qe %run %run.btm
    copy /qe "%1" %run.btm
    %run.btm %2$
    del /qe %run.btm
     
    c:> copy con: tctest.tc
    @echo off
    echo Hello %1!
    ^Z
     
    c:> tctest world
    Hello world!
    
    Not ideal, but it does what I need. Nowhere near enough validation, but it will be used in a controlled situation.
     
  5. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    grimblefritz wrote:
    | And since the wishing well is open, it would be VERY nice if tcc
    | could accept a BTM on stdin (borrowing an *nix convention of -
    | representing stdin/stdout in lieu of a filename):
    |
    |
    | Code:
    | ---------
    | tcc.exe /b -
    | ---------

    Isn't that just the command prompt? See also the "here document" section of
    help topic "redirection.htm".
    --
    Steve
     
  6. grimblefritz

    Joined:
    Feb 25, 2009
    Messages:
    16
    Likes Received:
    0
    No. The command prompt wouldn't require an option.

    Many other scripting languages, especially in the *nix space, will accept a script on stdin. If you try that with tcc, it literally tries to feed the command line from stdin. That's not the same as running a script, as evidenced by the behavior when things like IFF and DO and so forth are encountered.

    Think of it this way:

    Code:
    some_other_program_spewing_btm_code | tcc /b -
    Effectively tcc would snarf up stdin, drop it into a temp file and run it, and then clean up and die.

    And no, you can't simply do:

    Code:
    some_other_program_spewing_btm_code > tmpfile.btm
    tcc /c tmpfile.btm
    In many cases the program doing the spewing only allows you to specify the executable to receive stdout, not where to redirect stdout and then run a program.
     
  7. w_krieger

    Joined:
    Nov 2, 2008
    Messages:
    170
    Likes Received:
    0
    I really can't see why something like an "run" type command could not be implemented. One might run open a command or file with a desired extention, eg

    "run .bmp logo.sys"

    might run logo.sys as if it had a .bmp extention. [Sendto can do this].

    You could then elect to run various native programs as .exe or .com or .btm or .bat files in a similar way.

    One of the more obscure DOS versions [i think it's ptsdos] has a RUN and RH command that allows any extention to .exe files.
     

Share This Page