How to? Examples for the new tab completion feature

May 20, 2008
12,175
133
Syracuse, NY, USA
Here's a not very interesting example. If the command is TYPE, this will only the names of TXT and BTM files.
Load it with "tabcomplete /L typecomplete.btm"
Code:
::TYPECOMPLETE.BTM
if %1 NE TYPE quit 1

unset /q TABCOMPLETIONRESULT

do f in /p dir /ne /b /a:-d %2*.txt;%2*.btm
   iff defined tabcompletionresult then
     set TABCOMPLETIONRESULT=%tabcompletionresult %@quote[%f]
   else
     set TABCOMPLETIONRESULT=%@quote[%f]
   endiff
enddo
quit 0