hckr.fyi // thoughts

Adding PowerShell Core to the Hyper Terminal

by Michael Szul on

A lot of programmers are aware of the split in .NET between Framework and Core, but unless you live in the Windows scripting environment, you might not realize that PowerShell has also experienced this Renaissance. In one fell swoop, Microsoft has decided to open source the latest PowerShell (6), while also making it cross-platform. This version of PowerShell is being referred to as PowerShell Core, and it not only continues the fantastic development of PowerShell as a Windows scripting environment, but also brings that power to Linux.

As many of you know, I've been using the Hyper terminal as a terminal emulator, and in particular, I'm using it for its ability to have a tabbed interface, and along with the HyperStart script, I can choose my command line. Recently, I installed PowerShell Core on my work computer, and I added it as an option in HyperStart. Here's what you would need to do.

You'll notice some changes in the above gist from the last one (and again, this code was originally forked from another programmer). It's very easy to add another potential command line to the terminal emulator. We've added a couple of lines, and then edited the numbering.

First we add PowerShell Core as an option:

ECHO [4] PowerShell Core
    

We make sure to update the choices:

CHOICE /N /C:1234567 /M "> "
    

We then add the path to the PowerShell Core executable:

IF ERRORLEVEL ==4 "C:\Program Files\PowerShell\6.0.2\pwsh.exe"
    

It's that simple, and because PowerShell and PowerShell Core can be run in parallel, you can have each as an option in your HyperStart file.