Customized Windows command prompt

I personally use the command prompt on Windows a lot, but it’s always been very boring to look at. Now I know there are command prompt replacer apps out there which make it look much better (like Cmder), but I wanted to see how far we can customize it without installing any extra software. So let’s see how far we can go.

Startup script

The first step is to create a batch script which will be run when we start the console, and a shortcut in the start menu or taskbar to launch it. Creating a batch script is easy, just create a file called _startup.bat and put it in your user folder. You can add a welcome message to it if you like:

Shortcut

Next comes creating the shortcut. To create a shortcut, we can right-click a blank spot in our user folder, and select New > Shortcut. In the location field we can enter this:

The /K flag will run our script and return us to the command prompt. Now when we start the terminal, we should see our welcome message at the top.

our custom terminal, still looking pretty ugly

We can also customize the icon of the shortcut, by right-clicking it and going to Properties > Change Icon. In the icon select dialog we only have the icon exported by cmd.exe, but we can choose from a list of icons in shell32.dll by putting some randon text into the file select field and pressing Enter. This will throw an error, but will then default back to shell32.dll.

shortcut icon selection

Next we can add some colors to the terminal. Right-click the shortcut and select Properties > Colors tab. You can change any options on these tabs, but I’ve just changed opacity to 95%, and Screen Text to (red = 12, green = 180, blue = 12).

starting to look better

Another recent option on Windows 10 is under the Terminal tab, to disable scroll-forward. This removes all the blank space and the scrollbar on the right, which is quite cool.

Now we can drag this shortcut wherever we want, we can pin it to the start menu, or the taskbar, etc. Nice!

Better startup script

We now have a custom icon, custom color and a custom start script. We can enter any combination of commands into this startup script to customize it the way we want. Here’s what I’ve got in mine, if you want to use it, you can copy this script into your _startup.bat file.

Wow, what a mess. Windows batch scripts really are pretty terrible. Let’s analyze a few lines here though…

1-3: Sets the current working directory to your desktop.
5-10: Sets the window title, prevents command params being echoed out, and allows us to use delayed expansion, which allows us to overcome the way batch scripts handle variables inside of blocks. It allows us to use the !VarName! style instead of %VarName%, which is expanded during the line execution instead of just at the start of the block.
12-14: Gets the user’s display name into the UserDisplayName var.
16-26: Gets amount of installed RAM and puts it in the TotalMemory var.
28-34: Puts the system name into the ComputerName var.
36-44: Clears the screen and starts displaying the welcome message.
46-63: Displays free space for each drive.

done! and looking pretty good.

And that’s it! Since it’s running a batch script, you can also execute any command line application and use the output in your welcome message.