Unknown_CMD Not Working

Jun 2, 2008
284
1
Newton, MA
#1
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
 
Jun 2, 2008
284
1
Newton, MA
#5
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