How to run a PowerShell script with a hotkey and see the result
With KeyRoutines Pro, add a Hotkey trigger and a Run PowerShell step with your script or .ps1 file. A Script result condition checks the exit code or output, and Show banner tells you whether it worked, without a console window flashing up.
KeyRoutines Pro is a one-time $29.99 upgrade for up to 2 PCs.
Steps
- 1
Add a Hotkey trigger
Pick a chord such as Ctrl+Alt+P.
- 2
Run the script
Add Run PowerShell and paste the script, or point it at a .ps1 file. Pass values under Values; the script reads them as $env:KR_name.
- 3
Set limits
Set a timeout and a memory limit, so a stuck script is stopped with everything it started.
- 4
Check the result
Add an If with Script result on the exit code being 0, and Show banner "Done" or "Failed" with the output.
Tips
- Values from the routine are passed as environment variables, never pasted into the script, so a file name with quotes can't break it.
- Run command does the same for cmd commands or any program with arguments.
Questions
- Is scripting free?
- No. Run PowerShell, Run command and Run JavaScript are part of KeyRoutines Pro.
- Does it run as administrator?
- It runs as you. Use Pro's admin features if a script needs elevation.