Author Topic: Unable to acquire window or process for window function for command prompt  (Read 790 times)

noodleKnight

  • Newbie
  • *
  • Posts: 4
So I imagine this is some windows 10 funny business that's going straight over my head but basically, I want to be able to use the "display window" command to pull up my command prompt but every time I try to perform a windows function on a command prompt window I am met with the titular error ("Unable to acquire window or process for window function"). Does anyone have any idea what might be causing this? Windows functions seem to work fine for any other process...

Help is appreciated as always.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
The command prompt window isn't quite a normal window. When you start cmd.exe, that application starts a console session, which then interfaces with Explorer through conhost.exe to handle rendering and input

The API used for the window lookup apparently doesn't find that window (even when using conhost as the target).


A workaround would be to use the targeting feature to send a keypress (of a modifier, preferably, so it doesn't affect any running commands) to bring up the window, provided it wasn't minimized, which will bring up the window using a different API call.


Do note that you don't need a command prompt window if you're looking to run a non-interactive console command.
You can use the "Run an Application" action to run cmd.exe with the "/C" parameter if you need cmd.exe's specific features.

noodleKnight

  • Newbie
  • *
  • Posts: 4
Thanks again for the advice! Was trying to make a shortcut to turn off and on my mining software. This work around seems to have done the trick