2

According to the AHK Docs on Run, it accepts the following syntax:

Run, Target , WorkingDir, Options, OutputVarPID

Where Options can include:

  • Max: launch maximized
  • Min: launch minimized
  • Hide: 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:

Error Message

Q: How can I use the hide flag on the run command while still passing params into powershell?

1 Answer 1

6

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".

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.