Run powershell script with keyboard hotkey

I want to execute a powershell script (ps1 file) with a hotkey on my keyboard (e.g. CTRL + SHIFT + F).

I managed to create a shortcut script (right click in explorer> new> shortcut). Label target: "% SystemRoot% \ system32 \ WindowsPowerShell \ v1.0 \ powershell.exe -ExecutionPolicy Bypass -File" PATH_TO_THE_SCRIPT ".

When I execute the script manually (by double-clicking on the shortcut), it works like a charm. But when I try to assign a "Hotkey" in the properties of the shortcut (CTRL + SHIFT + F) and press the shortcut key just defined, nothing happens. What's the matter?

I am sure that this is due to security policies. But I do not know what it is.

This is my execution policy:

Scope ExecutionPolicy
----- ---------------
MachinePolicy  Undefined
UserPolicy     Undefined
Process        RemoteSigned
CurrentUser    Unrestricted
LocalMachine   Unrestricted

Any help is appreciated.

+4
2

. " ", !

, ?

+1

PowerShell . :

Set-ExecutionPolicy Bypass -Force

script.

, Powershell_ise (IDE powershell), 86x, 64 . ,

cd "enter desktop directory"
0

Source: https://habr.com/ru/post/1655699/


All Articles