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

Hotkeys Page in the Admin Console
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'
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'
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 modified 5mo ago