No 1 Best Windows Tool for command line

Thefuturebymob
7 min readJun 8, 2021

Follow this guide, and you’ll be able to use a single multi-tabbed window to launch different shells for Linux on Windows (WSL2), MSYS, Powershell, Cmd, SSH, Python environments based on Conda and venv, toolchain environments including Visual Studio, ESP32 the list is endless !

Windows Terminal….Who hell he ?

Windows Terminal appeared not so long ago (2021), in one of the myriad of involuntary Windows 10 updates. If you haven’t see it yet, you can get it from the Windows “Store”, simply search for it.

The idea is to stop using countless precariously stacked windows with cmd.exe or Powershell running, and move to a more efficient use of the golden desktop real estate.

It doesn’t look particularly exciting, and in fact it doesn’t really act very exciting either. But that’s how we like our terminals right ? Dumb, innocuous and a bit dull, a trusted friend that makes us feel good, because we are an inch taller.

Functionality wise, the Terminal comes with the default configuration of Powershell, Azure cloud and cmd. After messing around with the settings, I now have the following terminals setup

  1. WSL2 — Windows linux subsystem — bash shell
  2. Command Prompt (cmd.exe) — Admin and User
  3. Powershell
  4. Conda (with several ML environments)
  5. Visual Studio command shell
  6. Git bash
  7. MSYS
  8. Win Python
  9. SSH

I also have environments set up for various cross-compile embedded toolchains like ESP32, ESP8266, Maixduino, ARM, STM32 etc. And some large x86 build environments for things like FFMpeg etc

So, I now have a single application where I can start any one of 10 odd environments. Not bad eh ? “So what”, I hear you shriek !

Well yes this is actually quite an achievement, after programming for 30 years in all OSs, most Architectures, 6 languages etc even I was stumped on which way around slashes went, and how many quotes I needed. So as a service to my fellow developers, I offer you my recently gained wisdom, and show you how to set up the application for all these types of shells.

Firstly download and install the Windows Terminal App. Now Run it. It’s easy to get to the settings, simply click on the down arrow, next to the + (for a new tab) and it will bring up a popup menu.

Then click on the Settings menu button

Now open the actual JSON settings in a text editor.

The JSON settings will open in your default JSON editor, any text editor is fine to edit the file. If you’re worried about breaking it, save it as a backup somewhere. And if it wont load after you’ve changed it, simply roll back to the original using your backup.

In settings.json, do a literal search for “profiles”: (including the quotes), and you will see each of the default shell configurations, one for each button listed on the New Tab (again when you click the + sign at the top of the tabs).

When you find that same section in your settings.json, simply add any of these settings below. Just make sure that the GUID is unique (you can copy mine as they are as they are unique already). If you use your own GUIDs, edit a random character in the GUID field value, make sure its 0–9 or A-F as the numbers are hexadecimal. Also your paths will be different to mine, you will need to make sure they are correct for your setup.

Here are the actual settings for each shell type. At the end of this article there is a complete sample file.

cmd.exe

{
“commandline”: “cmd.exe”,
“guid”: “{0caa0dad-35be-5f56-a8ff-afceeeaa6101}”,
“hidden”: false,
“name”: “Command Prompt”
},

Admin cmd.exe

There are a few ways to do this, I use Windows gsudo already so this is the way I did it. If you want to do the same download gsudo here

{
“commandline”: “gsudo cmd.exe”,
“guid”: “{0caa0dad-34be-5f56-a8ff-afceeeaa6101}”,
“hidden”: false,
“name”: “Admin Command Prompt”
},

SSH

Just put in the username and the machine name. Below the username is pi, and the machine name is the IP address 192.168.0.0

If you have local computers you SSH to, say a few Raspberry Pis, then give them a static IP address in your home wifi router using their unique MAC addresses. That way they keep the same IP, even after reboot, otherwise this isn’t much good for hosts that have dynamic IPs !

{
“name”: “Pi3 Flight”,
“commandline”: “ssh pi@192.168.0.0”,
“guid”: “{860a4840–1111–43bb-aaa9-b654374af000}”
},

Powershell

{
“commandline”: “powershell.exe”,
“guid”: “{61c54bbd-c2c6–5271–96e7–009a87ff44bf}”,
“hidden”: false,
“name”: “Windows PowerShell”
},

cmd.exe with Toolchain

Create a batch file script that sets the environment path to your toolchain.

You can also change to any folder you like etc.

For example here’s a file called ffmpeg4.4.bat that appends to the path my FFMpeg 4.4 release folder

set PATH=%PATH%;D:\media-autobuild_suite\build\AMF-git\Thirdparty\ffmpeg\ffmpeg-4.1.3\x64\release\bin

Now I can run that ffmpeg4.4.bat batch file and also open a cmd.exe

{
“commandline”: “cmd.exe /K \”d:/scripts/ffmpeg4.4.bat\””,
“guid”: “{860a4840–31bd-43bb-aaa9-b2b4b74af000}”,
“hidden”: false,
“name”: “FFMpeg 4.4 Command Prompt”,
“startingDirectory”: “L:/Video/experiment/games”
},

Visual Studio Community

I am but a poor and lonely old man, my back is twisted, my eyes are weak etc and I can only afford Visual Studio Community Edition…..

{
“commandline”: “cmd.exe /k \”u:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Auxiliary/Build/vcvars64.bat\””,
“guid”: “{be7be391–7f49–4f6c-bb60-caeb099ce146}”,
“hidden”: false,
“icon”: “P:/Documents/icons/visualStudio.ico”,
“name”: “VS2019 Command Prompt”
},

MSYS

{
“commandline”: “V:/msys64/usr/bin/bash.exe -i -l”,
“guid”: “{b453ae62–4e7d-5e57-b989–0a998ec441b1}”,
“icon”: “V:/msys64/msys2.ico”,
“name”: “MSys64”,
“tabTitle”: “Msys64”
}

Git Bash

Some colours, and nice aesthetics added etc

{
“acrylicOpacity”: 0.75,
“closeOnExit”: “graceful”,
“colorScheme”: “Campbell”,
“commandline”: “u:/Program Files/Git/bin/bash.exe -i -l”,
“cursorColor”: “#FFFFFF”,
“cursorShape”: “bar”,
“fontFace”: “Consolas”,
“fontSize”: 10,
“guid”: “{b453ae62–4e7d-5e57-b989–0a998ec441b8}”,
“hidden”: false,
“historySize”: 9001,
“icon”: “u:/Program Files/Git/mingw64/share/git/git-for-windows.ico”,
“name”: “Git Bash”,
“padding”: “0, 0, 0, 0”,
“snapOnInput”: true,
“startingDirectory”: “%USERPROFILE%”,
“useAcrylic”: true
},

WinPy

I never have a default install of python ! As in I never have python.bat or python.exe on my path, I find it all goes South quicker than Canadian Geese at the first sign of snow.

I use WinPy, it’s installed but it’s not on my Path. When I need a Python environment I create one using the winpy python.exe. When I need to run python I open a shell and activate the environment. Switch to this way of working with Python its much less stressful, and you know which environment you are always in as its written on the command prompt.

To create a Python environment (so you can have multiple different packages and versions without conflicts and Pip overwriting each other), use this

<Path to WinPy>\scripts\python.bat -m venv <Path to where you store your Py Envs>\YourPythonEnvName

Then you use the activate.bat file that is created in that environment. So for example

M:\PythonWin\WPy64–3890\scripts\python.bat -m venv v:\pyenvs\winpy_1

Created a Py env called winpy_1, and this will open a shell with that all setup for me

{
“commandline”: “cmd.exe /K v:/pyenvs/winpy_1/Scripts/activate.bat”,
“guid”: “{832a4840-c1bd-43bb-aaa9-b2b4b22bfbc3}”,
“hidden”: false,
“icon”: “U:/icons/python.ico”,
“name”: “Winpy winpy_1”
},

Conda Python Environments

For all you machine learning obsessives out there. Miniconda and Anaconda, they both have something in common, I can’t quite remember what it is now, but anyway you get the gist….

Default conda base

{
“commandline”: “cmd.exe /K U:/Miniconda3/Scripts/activate.bat”,
“guid”: “{860a4840-c1bd-43bb-aaa9-b2b4b74afbc7}”,
“hidden”: false,
“icon”: “U:/Miniconda3/conda.ico”,
“name”: “Conda base”
},

Here’s a conda I prepared earlier, thats not the base
{
“commandline”: “cmd.exe /K U:/Miniconda3/Scripts/activate.bat U:/Miniconda3/envs/LSTM3090”,
“guid”: “{860a4840-c1bd-43bb-aaa9-b2b4b74afbc3}”,
“hidden”: false,
“icon”: “U:/Miniconda3/conda.ico”,
“name”: “Conda LSTM3090”
},

Azure

You get it for free, but for completeness

{
“guid”: “{b453ae62–4e3d-5e58-b989–0a998ec441b8}”,
“hidden”: false,
“name”: “Azure Cloud Shell”,
“source”: “Windows.Terminal.Azure”
},

Windows Subsystem for Linux— WSL2

And last but by no means least, here is the lovely little WSL

Mines an Ubuntu what’s in your wallet ?

{
“guid”: “{2c4de342–38b7–51cf-b940–2309a097f518}”,
“hidden”: false,
“name”: “Ubuntu”,
“source”: “Windows.Terminal.Wsl”
},

Ok I think that’s it. Should be easier to copy these templates than work out the path separators and quotes.

One extra bonus for reading all the way to here…Set the default profile (terminal), you’re favourite one. This will be the shell that opens when you just click the + sign, as opposed to clicking the down arrow and selecting a shell type. Search for defaultProfile, and set the GUID from the profile you want to use.

“defaultProfile”: “{0caa0dad-34be-5f56-a8ff-afceeeaa6101}”,

Many more articles coming soon

Thanks for reading.

The whole settings.json for the Windows Terminal (github.com)

--

--