According to the AHK Docs on Run
, it accepts the following syntax:
Run, Target , WorkingDir, Options, OutputVarPID
Where Options
can include:
Max
: launch maximizedMin
: launch minimizedHide
: launch hidden (cannot be used in combination with either of the above)
I have shortcut bound to a powershell script like this:
^4::
Run, pwsh -WindowStyle Hidden -Command "Stop-ElgatoKeyLight -Host 192.168.1"
Return
However, as noted in Powershell -WindowStyle Hidden still shows a window briefly, this doesn't prevent a brief flash of the console starting up
I can't quite seem to get the syntax right when adding hide
. When I try this:
Run, pwsh, -WindowStyle Hidden -Command "Stop-ElgatoKeyLight -Host 192.168.1", Hide
I get the following error:
Q: How can I use the hide
flag on the run command while still passing params into powershell?
You want to run:
Run, pwsh -Command "Stop-ElgatoKeyLight -Host 192.168.1", , Hide
Or using the modern expression syntax:
Run, % "pwsh -Command ""Stop-ElgatoKeyLight -Host 192.168.1""", , Hide
The way your code is currently written:
Run, pwsh, -WindowStyle Hidden -Command "Stop-ElgatoKeyLight -Host 192.168.1", Hide
As you pointed out, the parameters are Target, WorkingDir, Options, OutputVarPID
, so you're trying to launch pwsh
in the directory -WindowStyle Hidden -Command "Stop-ElgatoKeyLight -Host 192.168.1"
.