Run PowerShell script from status bar

Here are the steps to execute powershell from status bar:

  1. Preferences / File Displays / Status Bar / Custom Codes / Add
  2. Enter required powershell scritps like this:
args == "build"
    ? "<a href=""D:\Backup\Common\Powershell\start.ps1""><font color=""#F39C12""><b>🔨 Start</b></font></a>"
    : args == "yarn"
    ? "<a href=""D:\Backup\Common\Powershell\restart.ps1""><font color=""#2ECC71""><b>📦 Restart</b></font></a>"
    : args == "teleport"
    ? "<a href=""D:\Backup\Common\Powershell\Stop.ps1""><font color=""#3498DB""><b>🌐 Stop</b></font></a>"
    : ""

  1. Then go to Preferences / File Displays / Status Bar / Definitions
  2. Add custom code like this:

  1. You can aslo select specific script to show on status bar instead of all scripts:

image

6 Likes

This is using the status bar for something else than status info, but it is a nice example for anyone who wants to put all "empty space" in and around the lister to good use, as much as possible. I tend to do so myself (hence my hint a while ago about even using column header space - which of course is less equiped for such a thing than the status bar).

I think I will move some of my (status-related) button commands to the status bar too. Thx for this example.

can they go in a menu (on the statusbar)?

To add menu in status bar. Add <a id="FullMenu"> Menu </a> where FullMenu is the name of toolbar.

thx - doing that already - was hoping for a more elegant (read... less effort) solution