Ironman Software Forums
Continue the conversion on the Ironman Software forums. Chat with over 1000 users about PowerShell, PowerShell Universal, and PowerShell Pro Tools.
PSCommander allows you to command your desktop with PowerShell. It integrates with various Windows features to make it very easy to execute PowerShell actions. You can associate files, set global keyboard shorts, create context menu items and more.
PSCommander is a PowerShell module and available on the PowerShell Gallery. Install PSCommander with Install-Module
.
Install-Module PSCommander
PSCommander is part of PowerShell Pro Tools. You can purchase a subscription or request a trial license from our website. If you already have a PowerShell Pro Tools license that is installed, PSCommander is ready to go. If you want to install a license, you can use the Install-CommanderLicense
cmdlet.
Install-CommanderLicense .\license.txt
Once you have a license installed, you can setup commander to run when you login. Use the Install-Commander
cmdlet to run commander on login.
Install-Commander
Finally, you can start commander. PSScriptPad will open and will allow you to configure the default configuration.
Start-Commander
PSCommander configuration is defined using a config.ps1
file that is created within your documents folder. The first time you run commander, it will open PSScriptPad with a default configuration.
Commander providers various integration points into Windows. This section will describe how to configure each feature.
PSCommander provides the ability to configure the Windows tray icon. You can configure the icon and define the right-click menu items. This example creates a commander menu item that opens VS Code to the universal directory.
New-CommanderToolbarIcon -MenuItem @(
New-CommanderMenuItem -Text 'Source' -MenuItem @(
New-CommanderMenuItem -Text 'PowerShell Universal' -Action {
code C:\src\universal
}
)
New-CommanderMenuItem -Text 'Documentation' -Action {
Start-Process 'https://docs.poshtools.com/powershell-pro-tools-documentation/pscommander'
}
)
PSCommander also allows for the assignment of global hot keys to PowerShell script blocks. For example, you can assign a key combination like Ctrl+T
and use that anywhere to invoke a PS script. The following example uses this key combo to start notepad.
New-CommanderHotKey -Key T -ModifierKey Ctrl -Action {
Start-Process notepad
}
PSCommander can be used to create desktop shortcuts that invoke PowerShell. When the desktop shortcut is double-clicked, the PowerShell action will be invoked.
This example creates a shortcut all Calculator that opens calc.exe.
New-CommanderShortcut -Text 'Calculator' -Action {
Start-Process calc
}
PSCommander can create Windows Explorer context menu items that invoke PowerShell actions. These context menus can appear on folders and files. You can also dictate which type of file the context menu will show for by specifying the extension. By default, commander will display the context menu on all files.
This example creates an ‘Open with Wordpad’ context menu item that will appear on all files.
New-CommanderContextMenu -Text 'Open with Wordpad' -Action {
wordpad $args[0]
}
You can also associate specific file extensions with PowerShell actions. This example associates .ps2
file types and opens VS Code when the file type is opened. $args[0]
will contain the file path that was opened.
New-CommanderFileAssociation -Extension '.ps2' -Action {
code $args[0]
}
PSCommander can run jobs using simple CRON schedules. Note that PSCommander uses a single runspace so it’s not designed for long running scheduled jobs. This is handy for notifications or checking the status of services local or remotely.
This example uses the BurntToast module to notify me to take a break every 30 minutes.
New-CommanderSchedule -CronExpression '*/30 * * * *' -Action {
New-BurntToastNotification -Text 'Take a break!'
}
PSCommander allows you to command your desktop with PowerShell. You can try it for free and download it from the PowerShell Gallery. We’re always open to feedback on our Forums or public issue tracker.
Continue the conversion on the Ironman Software forums. Chat with over 1000 users about PowerShell, PowerShell Universal, and PowerShell Pro Tools.
Receive once-a-month updates about Ironman Software. You'll learn about our product updates and blogs related to PowerShell.