Making PowerShell "Posh"

Back in the days when DOS and Windows were separate programs, the default Command Prompt didn’t look exactly the way that it does now. I can’t recall if it was DOS 5 or DOS 6 that changed the default prompt to $P$G (“path” followed by “greater than”) which looks like the familiar prompt that we’re accustomed to: C:\Users\matt> – that is, the current working directory (path) followed by a “greater than” sign.

Back then, DOS had a “boot script” called AUTOEXEC.BAT that would set up the initial programs that supported all of the computer’s peripherals where you’d define your prompt. When I had the older version of DOS, one of the first things I’d do is edit the autoexec.bat and add the PROMPT $P$G, which is the familiar path prompt instead of the original default, which was just the current drive and ghe “greater than” sign: C>. I think there were some ways to get really fancy with the prompt using ANSI cursor movement and color control sequences, but displays at the time were both small and slow – fixed at 80 columns and 25 rows in most cases – there wasn’t much room to get fancy. Now we have terminal windows and high resolution displays that can give us a lot of real estate to play with.

Enter Oh My Posh! – Posh both because POwer SHell and because it’s fancy.

THe example above is my own Oh My Posh custom prompt. It shows my current Git repository status followed by the currently logged-in username (which is green because I’m signed in as a regular user but would be red if I were elevated to superuser). Not shown currently are my currently selected AWS Profile (fron my AWS_PROFILE environment variable) and my current Python virtual environment name and version. Finally, I have a portion of the current working directory, which is the full working directory here because I’m fewer than 3 levels deep.

Oh My Posh works best with a font that supports Power Lines and glyphs such as Cascadia Code PL or one of Oh My Posh’s Fonts, but there are profiles that don’t use the special glyphs in these fonts.

The installation instructions are here: Oh My Posh Windows Installation

There are themes to get you started. My theme is a custom one based on an older version of the agnoster theme.

2025

Making PowerShell “Posh”

Back in the days when DOS and Windows were separate programs, the default Command Prompt didn’t look exactly the way that it does now. I can’t recall if it w...

Back to Top ↑

2024

PowerShell Short Scripts

As a Data Engineer using Mirth Connect, it’s often tricky to review my team’s merge requests because the merge request document contains the XML representati...

PowerShell Short Scripts

When dealing with Python dependencies, it’s sometimes necessary to determine if a given project is using a given version of a library. Since our team is usin...

Storing dotfiles in GitHub Revisited

A while ago, I wrote about using a bare git repository to manage my dotfiles. That worked somewhat well, but it had some shortcomings. Since, I’ve started us...

Python Context Managers

One of my current projects involves some improvements to code that I wrote last year – specifically enhancing the “Patient Identity Fixer”, which is my pet p...

PowerShell for Data Transformation: JSON

My team at work has a custom FHIR resource that we work with often called an Operation Outcome. We generate one of these for nearly every record we process, ...

Back to Top ↑

2021

Raspberry Pi Zero W “Busy Light”

COVID-19 has us many of us working from home. My husband and I are both fortunate enough to be in this group. However, as a teacher, his schedule is very pre...

Back to Top ↑

2020

Raspberry Pi Setup Script

When I set up a Raspberry Pi, there are a few things that I have to do right out of the gate to make things easier on myself. They involve putting a few file...

Storing dotfiles in GitHub

While I don’t use Linux as my primary operating system, I do use it a lot both at home and at work. It can be frustrating to try to sync up configurations be...

Nitro Cold Brew at Home!

Anyone who knows my husband or me knows that we really like our cold brew, and they also know that we make our own at home. Nitro cold brew has become a bit ...

OpenVPN On Raspberry Pi

So you want to run an OpenVPN Server on a Raspberry Pi? I did too, but it wasn’t easy to figure out the first time. If you want to skip all of this and do it...

Back to Top ↑