1. Home
  2. Windows Tips
  3. Add a command line windows terminal app

How to add a command line to the Windows Terminal app

The new Windows terminal app is now available in the Microsoft Store which means anyone can try it out. You no longer have to compile it from its source on Github. The new Windows terminal app supports multiple command lines but out-of-the-box, it only has PowerShell and Command Prompt added to it. Here’s how you can add a command line to the new Windows terminal app.

Windows Terminal settings

Install the Terminal app from the Microsoft Store. Click the little dropdown arrow next to the plus/new tab button and select Settings. This is going to open a file called Profiles.json. In order to add a command line to the new Windows Terminal app, you have to edit this file. Before you edit it though, copy everything in the file, and paste it into a new Notepad file. Save it with the name Profiles and the JSON extension somewhere you know it won’t be deleted by accident. This file is basically a back up of the original settings.

JSON editor

You will need a JSON editor to edit the Profiles.json file. You can use Notepad however, it’s probably a good idea to use Notepad++ which is free but can format the file much better.

JSON syntax

Editing the Profiles.json file is easy however, if you’re unfamiliar with the JSON syntax, you need to know a few important things before you dive in;

  1. Do not use a backslash (\) in file paths. You must replace them with a forward slash (/).
  2. Always close file paths in double quotes.
  3. All lines must end with a comma EXCEPT for the last line in a section or block.
  4. A section in the Profiles.json file starts with its name declared within double-quotes. We will be editing the Profiles section (see screenshot below).

Add Profile

Scroll to the end of the “Profiles”: section, and paste the following there. You will need to edit it before you can save the settings.

{
"acrylicOpacity" : 0.5,
"background" : "#012456",
"closeOnExit" : true,
"colorScheme" : "Campbell",
"commandline" : "powershell.exe",
"cursorColor" : "#FFFFFF",
"cursorShape" : "bar",
"fontFace" : "Consolas",
"fontSize" : 20,
"guid" : "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"historySize" : 9001,
"icon" : "ms-appx:///ProfileIcons/{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.png",
"name" : "Windows PowerShell",
"padding" : "0, 0, 0, 0",
"snapOnInput" : true,
"startingDirectory" : "%USERPROFILE%",
"useAcrylic" : false
},

The lines you need to edit are;

  • “commandline”
  • “guid”
  • “icon”
  • “name”

Go to the following location and open the Profiles.json file with your preferred editor.

%USERPROFILE%\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\RoamingState

Remember that if this is the last profile within the profile section, you must remove the comma at the very end. If you plan on adding another profile below this one, leave the comma there but make sure the last profile doesn’t have a comma outside the curly brace.

In the “commandline” line, give the complete path to the EXE of the command line you want to add. If you’ve enabled Windows Subsystem for Linus, you can simple add “bash.exe” here.

In the “guid” line, you need to generate a new GUID and enter it there however, if you’re adding Ubunut’s bash, scroll down the relevant section below and use the GUID and icon path provided there. They’re present by default in the ProfileIcons folder.

For the “icon” line, give the  complete path to the icon file you want to use. The file must be a PNG file. The icon will appear in the menu next to the name of the command line it is for.

In the “name” line, enter the name of the command line e.g., Bash, Linux, or Python. Save the changes and you’re good to go.

Add Linux Bash to Windows Terminal

To add Linux Bash to Windows Terminal, enter the following Profile without making any changes to it.

{
"acrylicOpacity" : 0.75,
"closeOnExit" : true,
"colorScheme" : "Campbell",
"commandline" : "bash.exe",
"cursorColor" : "#FFFFFF",
"cursorShape" : "bar",
"fontFace" : "Consolas",
"fontSize" : 10,
"guid" : "{9acb9455-ca41-5af7-950f-6bca1bc9722f}",
"historySize" : 9001,
"icon" : "ms-appx:///ProfileIcons/{9acb9455-ca41-5af7-950f-6bca1bc9722f}.scale-100.png",
"name" : "Linux Bash Shell",
"padding" : "0, 0, 0, 0",
"snapOnInput" : true,
"startingDirectory" : "%USERPROFILE%",
"useAcrylic" : true
}

Add Python to Windows Terminal

In order to add Python to the new Windows Terminal app, use the following profile. You can change the GUID to something else if you want but it isn’t necessary. You must have Python installed on your system. You can get it here. You will need to edit the path in the “icon” line and change it to whichever file you want to use for the icon.

{
"acrylicOpacity" : 0.75,
"closeOnExit" : true,
"colorScheme" : "Campbell",
"commandline" : "py.exe",
"cursorColor" : "#FFFFFF",
"cursorShape" : "bar",
"fontFace" : "Consolas",
"fontSize" : 10,
"guid" : "{1850e97f-16dc-4281-9ea9-0100c4e852c5}",
"historySize" : 9001,
"icon" : "C:/Users/YourUserName/AppData/Local/Programs/Python/Python37/Lib/test/imghdrdata/python.png",
"name" : "Python",
"padding" : "0, 0, 0, 0",
"snapOnInput" : true,
"startingDirectory" : "%USERPROFILE%",
"useAcrylic" : true
}

Save the changes made to Profiles.json and the Windows Terminal app will show the new command line(s) that you’ve added.

Comments are closed.