Hotkeys

Hotkey support for PowerShell Universal Desktop.

Available in PowerShell Universal 2.8 or later. Requires a license.

PowerShell Universal Desktop supports global hotkeys that can be used to invoke scripts with key chords.

Define a Hotkey

To define a hotkey, you will need to edit the hotkeys.ps1 file in the .universal folder or through the Settings \ Configurations page within the Admin Console.

Hotkeys are defined using the New-PSUHotkey cmdlet. For example, the following will invoke MyScript.ps1 when Ctrl+I is pressed anywhere within Windows.

New-PSUHotkey -Key I -ModifierKey Ctrl -Script 'MyScript.ps1'

Environments

You can define which environment the hotkey runs within by using the -Environment parameter.

New-PSUHotkey -Key I -ModifierKey Ctrl -Script 'MyScript.ps1' -Environment 'pwsh'

Parameters

You can define parameters passed to the script by using the dynamic parameters provided by New-PSUHotKey.

For example, if a script accepts a -Parameter1 parameter, you can define that on New-PSUHotKey.

param($Parameter1)

Within the hotkey, just use -Parameter1.

New-PSUHotkey -Key I -ModifierKey Ctrl -Script 'MyScript.ps1' -Parameter1 'Test'

Last updated

Copyright 2024 Ironman Software