Charles Dye

Super Moderator
Staff member
May 20, 2008
Albuquerque, NM
Since time immemorial, the help file has offered this advice:

From a batch file, you can determine if <shell> is loaded by testing for the variable function @EVAL, with a test like this:

if "%@eval[2 + 2]%" == "4" echo <shell> is loaded!

This is (a) peculiar syntax in both shells and (b) not foolproof -- @EVAL's return value is affected by SETDOS /F. Also, the "loaded" terminology is a throwback to DOS days. I would suggest instead something like this:

A batch file can test whether it is running in TCC by attempting a numeric comparison:

if 01 == 1 echo Running in TCC!

This syntax is legal in both shells. In TCC this is a numeric comparison and true; in CMD.EXE it is a string comparison and false. Once you have established that the batch file is running in TCC, you can use internal variables like _CMDPROC, _4VER, _DOS, _DOSVER, and _WIN to further determine the operating environment.

You can prevent your batch file from running in CMD.EXE by giving it the .BTM extension. CMD.EXE doesn't recognize .BTM files as batch files.
Similar threads
Thread starter Title Forum Replies Date
Charles Dye Ye olde Doc Nits thread Support 1
J Vers. 18 Here doc redirection broken? Support 4
jbanaszczyk DOC: @expand Support 0
Frank caveat in doc for @FILES[] Support 0
Charles Dye Strange output, here-doc redirection, TYPE, //UnicodeOutput=Yes Support 6
Charles Dye More help nits Support 0
Charles Dye Documentation Help nits: @ZIPFILECRC Support 0
R Documentation A couple of Help nits Support 0
Charles Dye Documentation Help Nits Forever: Checksum functions Support 0
samintz Documentation Help nits Support 5
Charles Dye Revenge of the Help Nits Support 0
samintz Documentation Help Nits Support 3
JohnQSmith Ye olde Help Nits Support 4
S Fixed Help nits Support 7
Charles Dye The eternal Help Nits thread Support 0
C web help nits Support 1
S More HELP nits Support 5
S HELP nits Support 9
S SET /A question; HELP nits Support 8
S HELP nits Support 1
S HELP nits Support 0
dcantor 12.1 help nits Support 0
S HELP nits Support 3
samintz V12 Help Nits Support 5
Charles Dye Trivial cosmetic nits thread -- a longstanding tradition! Support 13
S HELP nits Support 3
Charles Dye Take Command 10 - trivial nits thread Support 2
C Add link to ewriter help to program group... Support 3
samintz How to? Search for %(command) in Help? Support 1
Joe Caverly Favorites in eWriter Help Support 6
Joe Caverly Quick Search in eWriter Help Support 1
vefatica Online help? Support 2 HELP!! I just updated to Version 28 and as usual I cannot make extended directory search work. Support 2
JohnQSmith New online help file wrong logo Support 7
Jay Sage Documentation Function @DRIVE Missing in Help Lists Support 0
D Documentation Typo in COPY help Support 0
FreezerBurnt Help making a CMD and TCC compatible batch file Support 7
Joe Caverly Documentation COMMANDS in Version 27 help Support 8
K_Meinhard How to? Help window position Support 7
U Command help on file names Support 5
D Documentation Help "Startup" page does not describe global lists Support 0
vefatica Help disappears? Support 6
rchapmanitt Help Purchasing Support 2
C version help Support 3
C Documentation Help Nit. REN / RENAME Support 0
Dmitry L. Kobyakov Documentation Error in the Help: the WINDOW command Support 0
vefatica Help for @PID Support 2
vefatica Need help with XML Support 3
Alpengreis Documentation Minor issue in help file for view /E Support 1
R Documentation Advanced Directives Help Support 0

Similar threads