interesting TCStarts.btm

#1
I have seen a few interesting TCStarts, at least the first few lines of some, and thought it might be nice to have people post theirs, after removing stuff that is not wanted to be shared.
 
May 20, 2008
456
2
#2
My actual TCStart.btm is only a couple of lines:
Code:
@echo off
call %@path[%comspec]..\DAT\JPStart.BTM
My actual TCExit.btm is similarly abbreviated. I have been using TCMD since the 4DOS days. The install directories keep changing with major version included in the folder name and I often have multiple versions installed simultaneously, especially with the overlap of use when a new version comes out. It became tiresome to keep multiple copies in sync. So, I created the DAT folder and put the main files for start, exit, alias, function, etc. in that. That relieved the version sync issue.

As for what the JPStart does, it checks and does a few things. Caveat: It's legacy and should probably be cleaned up some. For an idea of why some of this is as it is, my typical install path is C:\JPSoft\TCMD##. Here is the start of my BTM:
Code:
@echo off
REM Abort if transient
if %_transient EQ 1 goto end

REM Set paths for JPSoft and root folders
set /e JPPath=%@full[%@path[%_cmdspec]..\]
set /e RootPath=%@full[%JPPath\..\]

REM Log start of TCC
if not direxist %JPPath\Log md %JPPath\Log
echo %_date %_time PID:%@format[5,%_pid]-Start(1)  SHRALIAS:%_shralias  Ver:%_4ver.%_build  Title:%_wintitle) >> %JPPath\Log\tcc.log

color bright green on black

REM If shalias not loaded, load it now along with aliases and functions
iff %_shralias eq 0 then
    shralias
   
    alias /R %JPPath\DAT\alias.dat
    iff %_cmdproc NE TCCLE then
        function /R %JPPath\DAT\function.dat
    endiff
endiff

prompt $+$P$G%%@if[%%@len[%%_cwd] GT 25,$_,``]
It also sets the some env vars and logs the BTM ending, Start(2), as at the Start(1) above. In the remainder of the BTM, there is a bunch of stuff that has been commented out. For example, at one point, TCMD did not remember window position. I like mine in the upper right of the desktop. So, there was code to check screen resolution and reposition the window. The code above and in another section for TCCLE is also redundant as I no longer use that, but it's still there just in case. I don't think the RootPath env var is used any more either. I keep my TCC tab width at 80 columns, which is why I have the wrap in the prompt. My start BTM is nothing really fancy, but sufficient for my needs at the moment.
 
#3
Since you ask nicely, here's mine. A couple relics here and there, and nothing too fancy (except... the prompt, which is as monstruous as I like it to be).


Code:
@echo off

iff "%_transient" == "0" then
  CHCP 1252
  REM CHCP 65001

  function substituted=`%@if["%@left[3,%@truename[%1\]]"=="%1\",0,1]`

  unsetarray /Q COLORES_DE_DISCOS
  setarray COLORES_DE_DISCOS[26]
  call %HOMEDRIVE%%HOMEPATH%\TCMD\colores_de_discos_para_%_host.btm
  function colorDeDisco=`%@if["%@substituted[%1]"=="1",36;2,%COLORES_DE_DISCOS[%@eval[%@ascii[%@instr[0,1,%1]]-65]]]`

  REM if "%_DOS" == "WINXP" ALTENTER /D

  set PATH=%PATH%;C:\LDC

  alias /R "%HOMEDRIVE%%HOMEPATH%\TCMD\alias.txt"
  REM history /R "%HOMEDRIVE%%HOMEPATH%\TCMD\historia.txt"

  set ncmd=0
  alias post_exec=`set ncmd=%@inc[%ncmd] & title %ncmd`

  set TCMD_OFICIAL=21.0
  prompt `%@exec[@pwd]`$e[37;1m$d$s$t$e[0m$s%_dos%:%_dosver%.%_osbuild%$s%_cmdproc%:$e[`%@if["%_version" eq "%TCMD_OFICIAL",37,33;41];1m`%_4ver%.%_build%$e[0m$s$e[36;[email protected]%%_ip%%$e[0m$s%_pid%$s$e[33;2m$z$e[31;1m$+$e[0m$_{%%ncmd}$s$e[36;2m%_host%$e[0m$s$e[32;1m$r$e[0m%@if["%_elevated" eq "1",$s$e[43;5;30;2mELEVATED$e[0m,]$s$P$g

  echo I am ready, Master.
  echo.

endiff
The prompt uses @pwd, which is defined in alias.txt as:

Code:
pwd=for %A in (%_ready) do ( echo ^e[%@colorDeDisco[%A]m%@format[-12,%@label[%A]] %@if["%@substituted[%A]"=="1",*, ]%@cwds[%A]^e[0m )