Unknown_CMD Not Working

Jun 2, 2008
376
2
Newton, MA
My Unknown_CMD alias calls a batch file to deal with the error (allowing me to edit the command line and resubmit it), and this has stopped working in version 17. After adding code to display the arguments being passed to the batch file, it appears that the command line is no longer being appended.

Has anyone else seen this? (Does anyone else use this TCC feature?)

-- Jay
 
May 20, 2008
11,411
99
Syracuse, NY, USA
I see it too.
Code:
v:\> type uc.btm
echo UC.BTM
echo %$

v:\> alias unknown_cmd v:\uc.btm

v:\> foo
UC.BTM
ECHO is OFF
 
Jun 2, 2008
376
2
Newton, MA
In case it is useful for others (and in case someone can suggest improvements), here is the BTM script that I call from the Unknown_Cmd alias.

Code:
@echo off

:: This script is used for the UNKNOWN_CMD alias to process
:: bad commands

:: Save two copies of the command line, one for editing and one
:: for reference

*set ___tgt=%$
*set ___tgt0=%$

:: Alert user with beep and message

echo.
beep 440 2
echoerr OnError.btm: Not a valid command. You may edit it or
echoerr press ENTER to abort it.
echo.

:: Allow editing of the command line

input /e %%___tgt

:: If command line is now empty, quit

if %@len[%___tgt] EQ 0 goto done

:: If the command line has not been changed, quit

if %___tgt EQ %___tgt0 goto done

:: Add modified command line to history and run it

echo.
history /a %___tgt
%___tgt

:done

unset ___tgt ___tgt0
 
Similar threads
Thread starter Title Forum Replies Date
MickeyF Why does this batch file give me 'unknown command "else"' error? Support 17
T Unknown command Support 4
samintz WAD Unknown Command? Support 3
C history is getting deleted under unknown circumstances Support 9
vefatica TCC: Unknown command "False" Support 4
R commmandline telnet: "Unknown command" Support 2
G Copy a file to unknown directory name Support 5
T WAD CMD incompatibility Support 14
sully9 How to? Unexpected %DATE% CMD variable format (vs DATE /T format) in CMDebug Support 1
L FTYPE in TCC, less quirky than in cmd.exe Support 3
Peter Murschall Single-line Do-CMD is a bit uncooperative. Support 6
FreezerBurnt Help making a CMD and TCC compatible batch file Support 7
T Date format date different from cmd Support 7
D Differences between TCC and CMD with COPY /b Support 4
M Oracle batch OPatch.bat.bat not working in TCC but correctly in CMD Support 5
E TCC/CMD difference Support 5
S How to? Deinstalling TC/reinstating execution of bat files by cmd in Win7 Support 31
D How to? Pass OpenHere Folder to CMD? Support 6
R Difference between TCC and CMD: variable names with hyphens Support 4
M WAD "Pictures" directory is empty in TCC but not in CMD or Explorer Support 4
rps Cmd history recall Support 4
rps Documentation TITLE cmd docs Support 0
Joe Caverly PUSHD with UNC path in CMD.EXE Support 2
W Starting program for word to pdf conversion (difference cmd and tcc) Support 13
Joe Caverly Using this CMD technique from TCC Support 17
W If command - different with CMD Support 6
I how to make TCC default/replace cmd.exe? Support 9
R FOR usage error from TCC but not from CMD Support 16
I findstr works in cmd but not in tcc Support 5
D Pasting Unicode data has different behavior on TCC and CMD Support 2
M Command line parsing differences between cmd.exe and TCC Support 6
Joe Caverly Works with CMD.EXE, no output with TCC.EXE Support 7
Joe Caverly tcommand(cmd) Support 13
L WAD ECHO. expansion of non-existent env-vars differs from CMD.exe Support 6
Joe Caverly "Functions" in cmd.exe batch files Support 6
Joe Caverly Works in debugger, not from cmd line Support 1
K CMD, TCC, VisualStudio 2017, VcVars* differences Support 1
D Does TCC improve CMD's implementation of ECHO? Support 6
P Labels in batch files: TCC vs CMD.exe Support 9
Patulus Yet another thread on CMD compatibility Support 16
A Fixed (CMD compat) START /D fails to recognize the switch option. Support 3
Joe Caverly CMD.EXE and filename(1).ext Support 3
H DOS CMD Sort+Add Sequence+Remove Sequence number Support 12
T WAD Difference between TCC and CMD in handling multi-command lines Support 6
C Nested IF syntax — TCC behaving differently to CMD Support 12
T CMD incompatibility Support 14
V Network share slowness vs CMD? Support 19
P Fixed Rexx .cmd files no longer work in TCC 20 Support 3
TT's Help! Uninstalling TCC did not restore cmd.exe as Win10 default batch file processor. Support 4
R How to? Display text same as in CMD Support 14

Similar threads