Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to have windows autocomplete custom commands?

I'm running Console2, which I believe is just an interface to windows cmd

I have a custom batch file that does most of my dirty work for me, but there are lot of commands in it now. Is there a way I can get a tap autocomplete working for it in the windows command prompt?

For example: my script is called rob.bat and it takes in a various number of arguments

It'd like to type rob set{Tab} and then have it cycle through

setup_envvars setup_userprefs setup_whateverothersetupscriptsIhave

Is there a way to do this?

like image 446
Erotemic Avatar asked Jan 22 '13 18:01

Erotemic


People also ask

How do I use autocomplete in CMD?

Using autocomplete is as simple as pressing the [TAB] and the active command line options will fill-in. If more than one option is available, you can hit [TAB] twice to display all possible choices and continue typing until there is only one matching choice left.


1 Answers

Console2 has no special provisions for tab completion and instead relies on the program running within it to provide such features. Picture Console2 as little more than something that runs a console program hidden somewhere, regularly polls that hidden window for changes, and forwards all input to that window; this is, in essence, what's happening.

Note that Console2 does nothing special with cmd. You can run any shell within it. As for customizing tab completion, cmd offers nothing of that sort. You may be able to change this by installing clink, which has extension points for Lua code. Another option would be PowerShell, which has customizable tab completion out of the box, either by wrapping your program in a function that provides the necessary parameters, or by writing a custom TabExpansion or TabExpansion2 function.

like image 181
Joey Avatar answered Oct 26 '22 14:10

Joey