How to manually install Command Line Interfaces on Windows
This guide will explain how to setup a CLI on Windows 10. The intended reader is someone who is interested in automation or programming, but doesn’t know where to start. You should be familiar with navigating your filesystem, such as knowing how to open the Downloads folder, being able to see file extentions, and creating new directories.
If you’re a writer/editor and wondering why the heck you should learn about CLIs, check out Vale, a programmable style guide.
Why manual installation?
This method works for every program in existence, as long as the producer offers binaries. PowerShell 7, Node.js, Python, Monero, etc. Popular projects, such as Python, have “wizards,” installers, or distributions (such as Anaconda for Data Science) to complete these steps for you.
To use programs that aren’t connected to a package managment ecosystem, they have to be installed manually. Maybe you don’t want to bother with auto-updates, or you’re installing on an external harddrive.
Also, if you have restrictions on a work computer, you can install simple utilities without prompting for Administrator Privileges. These CLIs typically don’t need advanced permissions.
Installing a program manually is as simple as unzipping a file, hence it’s sometimes called “zip” install. Connecting it to the terminal is trickier.
Check system type (32- or 64-bit) #
If your computer has been made within the last 10 years, it probably has a 64-bit processor. If you want to check, here’s an article on how to determine the version of your operating system.
For the purposes of this guide, we are installing
jq, a lightweight tool for manipulating JSON.
- Head to the jq “Releases” page on GitHub
- Download the right file for your system. For Windows 64-bit:
- Create a new folder to store the program. For example:
- Rename the executable to
- Place it into your new folder
“32-bit” binaries may sometimes be labeled “x86”
“amd64” is the same as “x64” and “x86-64”. Anything with “64” in the name is for 64-bit.
Add the program to your Systems Environment Variables path #
Register the program as a command on the terminal.
- Click on Start Menu and type
path(automatically pulls up Windows Search)
- If you own the computer, choose “Edit the system environment variables”
- If you don’t have admin privileges, choose “Edit environment variables for your account” and skip to Step 4
3. Click on [Environment Variables]
4. Under User variables for xxx, double-click on Path
5. Click [Browse]
6. Find your directory where the program is stored, such as
C:drive is typically under “This PC”
- Click [OK] on every window to save.
Check that the program runs #
- Start Menu > Type
- Open “Command Prompt”
- Type in
- You should get a
Because our program is called
jq.exe, it can be evoked with a
jq command. Likewise, a program named
app.exe is called
app (no extension) in the terminal.
If you want to download multiple jqs, name them as you want and place them within the same folder. For example, if you download version 1.5 and 1.6 for testing purposes, rename the newer one to
jq-1.6.exe, and you can evoke
After all steps are completed, you’ve installed a CLI manually and finished the tutorial!
Defining binaries and terminal #
A binary refers to a file that’s ready to run on a machine (compiled to a machine-readable format) which in most cases, is a program that runs on specific architecture. Binaries for mobile devices are different from binaries for computers because they use different hardware, and the binaries for Mac OS are different from the binaries for Windows because the operating systems are coded differently.
This is opposed to “building from source,” where you can download the human-readable source code, but to actually use the program, it needs to be compiled.
On Windows, programs typically have a
.bin extension. As always, only download from trusted sources. User discretion is the best antivirus.
It’s the black screen that you see in movies, when a hacker character conducts programming magic. In Windows, there are 2 different terminals: Command Prompt and PowerShell.
Before Graphical User Interfaces (GUIs), there was only text. When instructing the computer to copy files and run system tasks, machines don’t need a desktop. Desktops are a human affordance. Automation of grunt tasks is written into scripts, because text is easier to copy and transfer.
Every operating system comes with preinstalled scripts and programs. Here’s a list of Windows commands.
Due to the complexity of computers, the terminal has many other names, such as “console,” “shell,” and simply “command line”. Stack Overflow thread on the origins of the terminal.
Intro to CLI Syntax #
As the field of computing evolved, programmers adopted the conventions for POSIX-compliant syntax. This type of program is referred to as a Command Line Interface (CLI).
The format to evoke a CLI is as follows:
app command argument --flags
appspecifies the program
commandcalls a particular function, although this is optional based on the programmer’s whim, and not all apps have commands. jq doesn’t use commands in its syntax, but git does.
- Flags are prefixed with two
--hyphens to indicate the full name of a flag, which is typically a type of toggle, but again it depends on the program.
-hyphen flags are aliases (1-letter shortcuts) because flag names get long and tedious to type out.
- Aliases can be combined in one hyphen. For example, a programmer states that to print out the module version, there are aliases to go with it. These lines are equivalent evocations (they are case sensitive):
app --Version --verbose
However, these are only conventions, so always read the documentation.
Interpreting documentation #
When reading the manuals of other programs, documentation for syntax usually is written out as:
app arg1 arg2 … argN [–optional-flag]
Optional arguments and parameters are denoted inside square brackets
. Usually, there are examples to show the proper evocation and use cases.
If you are interested in exploring CLIs further on Windows OS, I highly recommend installing PowerShell 7+ or activating the Linux Subsystem so that you can use Unix syntax. The Command Prompt and old versions of PowerShell use Windows-specific conventions, where the lack of cross-platform compatibility is annoying. Or, if you don’t want to download stuff, try remote computing with GitPod.