example of sprite using batbox
Coding Basics, Developer Tool

BATBOX – the soul of cmd

Batch is not a language with lots of plugins/tools. This leads to limitations with how you can use CMD graphically. This is one of the reasons that darkbatcher (a legend among the batch community) has created a plugin: BATBOX.

BATBOX not only helps you use the CMD console graphically, but also extends user interaction, such as with a mouse and keyboard. It also allows you to take key combinations from the user.

Other things BATBOX can do includes putting your text in different locations according to the coordinate given, changing the console’s colors, and getting the user’s mouse input. If you are interested to see the official documentation from the creator himself, here is the link.



You can download the plugin from the GitHub Page, there you can find additional help for the plugin. Inside the \bin\ folder, you will find a precompiled executable (batbox.exe). Simply add that to your PATH or distribute it with your application to use the plugin.

The syntax of the plugin is very simple, and follows the same pattern in all commands:

batbox.exe <switch> <arguments>

For example, if we wanted to print a string of green text at a specific coordinate, we would execute this command:

batbox /g 5 5 /c 0x0a /d "This is a Green Text starting at location 5,5"

If you want to print the colored text you must use the /c switch with the color you want. The following is a list of commands available in the plugin as well as their arguments:

  • /d [text] : displays the text (read more)
  • /g X Y : changes cursor’s position (read more)
  • /c color : changes the color of the console (read more)
  • /m : get the input from the mouse and return the coordinate of the cursor and which button is clicked on the mouse (read more)
  • /k[ _ ] : get the input from the keyboard and save its ASCII code (echo %errorlevel% is used to see and verify the ASCII code of the pressed key on the keyboard.) (read more)
  • /a <ASCII> : it takes the ASCII code as input and prints the character (read more)
  • /w duration : it makes delay in between commands (read more)
  • /f state : changes console’s window mode (read more)
  • /s file : plays a .WAV file. (read more)
  • /o offsetx offsety : moves the origin of the console (read more)
  • /h mode : hide or show console’s cursor (read more)
  • /p mode : changes the console’s window mode (read more)


For this demonstration, I will be displaying a text (Devansh Bisht) at coordinates 25 10, and the console color will be changed to the ‘0x0b’ color.

@echo off
batbox.exe /g 25 10 /c 0x0b /d "Devansh Bisht"

The output of the above command would be something like this:


By using BATBOX, we can get input from users using a mouse or keyboard. In the case of the mouse, it will give the coordinate of the cursor and which button is clicked (1 for left and 2 for right button) as output.

Note: With the New update of Windows CMD console after Windows 7, Windows by default enables the QuickEdit mode. This prevents users to directly click inside the CMD console (It adds Windows own additional layer over CMD console windows). For the mouse command to work properly, you need to either manually disable the QuickEdit option, or use a plugin/tool which can help you to do that efficiently. (Right Click on CMD Title bar > Properties > Options > QuickEdit > OK)

In the case of the keyboard, it will save the ASCII value of the character typed and print it if the variable %errorlevel% is printed. We can also print the character of the given ASCII value.

batbox.exe /m

batbox.exe /k

batbox.exe /a 69

Here as you can see in the above picture first, I left clicked on the mouse and then right-clicked and got the input accordingly.

In this case, after running the command “batbox.exe /k”, the input given is “d” and its ASCII value is saved in %errorlevel%. Additionally, with “batbox.exe /a 100” it gives the output of thecharacter with an ASCII value of 100.


You can hide the console’s cursor by using the “batbox.exe /h 0” command, and it can be unhidden by using the “batbox.exe /p 1” command. The same can be done to console itself by using the “batbox.exe /p 0” command to hide, and the “batbox.exe /h 1” command to show the console.

The above specifies the mode for hiding the console window and cursor. You must specify the display mode that will be set for the command prompt’s window or cursors mode. For the cursor (/h), it can only be 0 (hide) or 1 (show). However, for the console (/p) there are various modes such as :

  • 0: Hides the window.
  • 1: Activate and show the window
  • 2: Activate the window and minimizes it (show it in the taskbar).
  • 3: Activate the window and make it maximized.
  • 6: Minimizes the window and activates another window.
  • 10: Show the windows and set their size and their position to the default values.


You can set a delay in between command line execution using “batbox.exe /w duration” where duration is time in a millisecond by which the next command sequence will be delayed. In the video below, we have created a typing effect where each character is displayed with a delay of a few milliseconds in between them.

batbox.exe /d "k" /w 300 /d "a" /w 250 /d "r" /w 300 /d "a" /w 300 /d "n"
example of creating a delay between commands


“batbox.exe /f state” is used to change the state of the console between windows mode and fullscreen. If the parameter is 1, it will change the state to full-screen mode, and if the parameter is 2, it will change the state to window mode.

“batbox.exe /o offsetX offsetY” this command will change the coordinates of the origin. BATBOX considers the upper left corner of the console as (0,0). This command will change it as per the users given coordinates.


This plugin can be used by anyone who wants to use the console more graphically, and enable more user interaction. It can also be used in making games and other stuff. Some of the examples are given on our GitHub. I hope that you enjoyed the article. You can discuss the plugin in Discord and comment below. Thank you for your time.

Leave a Reply