Boxes -Spice up boring Bash or Powershell scripts

boxes.pngBoxes is a text filter which can draw any kind of box around its input text. Box design choices range from simple boxes to complex ASCII art.  Boxes come with a good collection of ASCII art to start with.  I’m a sucker for boxes, they spice up what would be boring script files.  Boxes were always available on Linux, and now it’s available under Windows.  That’s if you can find them.

This little ditty is a reminder for myself of how to install this on a Windows machine so it is available from everywhere.

Boxes are from Thomas Jensen, download them from this link and save yourself a headache using google to find either boxes, Linux or combinations.  Version 1.2 has been released and has a few extra little goodies.

Getting it installed so you can use it any Powershell script on your system is a little difficult but worth the effort.

Part of my setup for every Windows system I use is to create a directory under the C:\ root to store the commands that are mine.  These are mostly portable applications but include little utilities like Boxes.  I call this directory C:\myCommands.   When I add this directory to the PATH statement it makes all those commands I added to the directory, available from any directory on the computer.

2017-08-21_15-32-07.png

Adding the path is done by editing the environment variable for your account, not the system account.  Look for the Path variable and Edit it.

2017-08-21_16-40-27.png

Then add the special place you created for your stuff.  In my case (C:\myCommands).

2017-08-21_16-40-31.png

When you unzip the BOXES.ZIP program from this link, it is just 2 files.  The EXE which does the work and the CFG which has the ASCII artwork in it.  I unzip them both into the (c:\myCommands) directory.

2017-08-21_15-33-58.png

The last step to getting boxes everywhere is to add a new environment variable to your account.  Start with looking for environment variables.

2017-08-21_16-47-19.png

The name of the new environment variable is BOXES.  The value is your special place (C:\myCommands).

2017-08-21_16-47-36

Verify that the new environment variable has been created.

2017-08-21_16-47-42.png

To have all of this stuff to start working you will need to reboot.  

Now open up the PowerShell window and type:

write-output "GeekMustHave rocks!" | boxes -a hc -d ian_jones

The (ian_jones) is one my favorite ASCII art frames.  There are plenty more art frames in the CFG file.

2017-08-21_16-54-56.png

I also have a YouTube Channel (GeekMustHave) no spaces or your get the makeup ladies.

If you stop by to visit please subscribe to let me know this post helped you.

https://www.youtube.com/channel/UChNSlqKgG8_l0h0C8vRLvbA

 

 

Powershell 5.0 on Windows 10

power01.jpgPowerShell version 5 is installed by default on Windows 10 systems.  However, if you had a previous version, say version 1.0 installed, the new version 5.0 gets installed beside it.  Having both PowerShell version installed can be a problem.  The key is know where each version installed and how to verify which version you are actually running.  Now that PowerShell is available “Everywhere” it may become more of a candidate for managing all systems across Windows, Linux and Mac.

Determine Version

To determine the PowerShell version you must open PowerShell and run the following command

  $PSVersionTable.PSVersion

If you are running Version 5.0 of PowerShell you should see something along the lines of the screen below, anything else is probably not Version 5.0.

power02.jpg

 

Where is Version 5.0

Version 5.0 is now located in this directory

power03.jpg

Since most of the stuff you do with PowerShell is admin work you may want to set the shortcut to run in admin mode automatically.

This is what the non-admin version of PowerShell looks like

power06.jpg

So go to wherever your shortcut is located and right-click and get to the “Properties”.

power07.jpg

Click on Advanced button to get to the super-admin stuff.

power08.jpg

The check the Run as administrator, with great power comes great responsibility.

Responsibility.gif

 

Now when you click on the PowerShell you will be prompted with a Windows pop-up asking you to confirm your new power.  After you accept the responsibility PowerShell will look like.

power09

You may want to consider giving the PowerShell ISE some of that Spidy Admin love as well.  I do most of my work in the ISE so it makes sense to give it the “power” too.