Is there a command line utility equivalent to wmctrl on Windows

11

2

I'm trying to write a remote window manager so that I can control my open windows via bluetooth using anyremote. There's wmctrl for Linux that manages windows from the command line. Is there similar tool in Microsoft Windows? I.e. A command line based window manager for Microsoft Windows.

If there are existing command line hacks that I could use to get the list of open windows, and bring a certain window to the front and give it focus, let me know.

Vik

Posted 2011-06-16T02:36:32.837

Reputation: 212

Answers

8

NirCmd by Nir Sofer is a command-line tool which can manipulate windows in all sorts of ways.

It can also automate dozens of other little tasks, like shutdown, shortcuts, screenshots, volume control. A proper Swiss-army knife of a tool.

The general format of the window manipulation commands is

nircmd win show/hide/min/max/center/close title "Window Title"

but there's a whole lot more you can do.

njd

Posted 2011-06-16T02:36:32.837

Reputation: 9 743

In my case, I've typed this command in cmd title A; I've open another cmd, and typed this command nircmd win close title "A"; Not working though – mr5 – 2015-08-27T02:58:08.853

2

Windows, like Unix, has multiple shells. "CMD.EXE" is by far the best known, but PowerShell is far more capable. It's built on top of .NET, and therefore can easily manipulate windows. See https://stackoverflow.com/questions/4993926/maximize-window-and-bring-it-in-front-with-powershell for an example.

MSalters

Posted 2011-06-16T02:36:32.837

Reputation: 7 587

1

An alternative to PowerShell and NirCmd is of course JP Software's TCC/LE and TakeCommand.

They have the ACTIVATE command, that can do on Win32 pretty much all of the minimize/maximize/top/bottom/pos/close stuff that wmctrl does for X. Of course, some wmctrl mechanisms have no meaning on Win32 and no equivalents for ACTIVATE. Conversely, ACTIVATE can do some Win32 things that wmctrl has no functions for, such as manipulation of the z order, use of the taskbar, flashing, and modification of the "topmost" flag.

They also have the KEYSTACK command that can be used to send simulated keyboard input to windows.

JdeBP

Posted 2011-06-16T02:36:32.837

Reputation: 23 855

1wmctrl can set above and below. – peth – 2012-12-20T17:46:58.657