Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Unknown_CMD Not Working

Jun
552
4
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
 
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
 
A plugin unknown_cmd() handler does receive the entire command line.
 
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

Replies
0
Views
1K
Back
Top