Skip to content
/ RadLine Public

Improved command line completion for cmd.exe

Notifications You must be signed in to change notification settings

RadAd/RadLine

Repository files navigation

RadLine

Improved command line completion for cmd.exe

Windows Releases commits-since Build

Details

RLoadDll.exe injects the RadLine.dll into cmd.exe process.

On startup the RadLine.dll replaces the ReadConsole function with its own. This allows it to intercept the command line completion behaviour.

Command line completion

This was the main reason for creating this utility. Completion is looked up using the lua script RadLine.lua. The function FindPotential is called with the current command line and returns an array of potential matches. The matches are then listed under the current line.

Auto terminate batch file

To enable:

set RADLINE_AUTO_TERMINATE_BATCH=1

This setting will auto respond y to the Terminate batch job (Y/N)? prompt.

Expand Tilde

The ~ at the start of an argument is expanded to %USERPROFILE%.

Post command execution

The contents of the environment variable RADLINE_POST are appended to the current command.

For example:

set RADLINE_POST=echo Error: ^%ERRORLEVEL^%

Dynamic environment variables

__PID__ will show the process id of the cmd process.

PROMPT environment variables in the prompt variable will also be expanded.

set foo=%(cmd /c echo bar)% the command in the brackets will expand to the output of the command.

Install

To install, download the zip and decompress to %APPDATA%\Radsoft\RadLine

Add the following lines to your cmd startup script:

set RADLINEDIR=%APPDATA%\Radsoft\RadLine
"%RADLINEDIR%\RLoadDll.exe" /d - "%RADLINEDIR%\RadLine.dll"