Cygwin / Windows 10 cli: is there a command that can focus a application/window?
How do I set focus to a Window?
You can use nircmd win focus ...
.
Example:
nircmd win focus title "bash"
where bash
is the title of my Cygwin Terminal window.
Syntax
nircmd win [action] [find] [window to find] [Additional Parameters]
There are different ways to specify the windows to find
:
handle: Finds the desired window by specifying the handle of the window in [window to find] parameter. id: Finds the desired child window by specifying the id of the child window. Useful only for child windows. class: Finds the desired window by specifying the class name of the window in [window to find] parameter. title: Finds the desired window by specifying the exact title of the window in [window to find] parameter. stitle: Finds the desired window by specifying the first few characters of the window in [window to find] parameter. ititle: Finds the desired window by specifying a sequence of characters that exists in the window title. alltop: All top windows. alltopnodesktop: All top windows, except of desktop and tray windows. active: The current active window. foreground: The window in foreground. desktop: The desktop window process:Finds the desired window by specifying process ID (for example: /3412) or process name (for example: firefox.exe).
Source Nircmd Win
Go to NirCmd - Windows command line tool to download nircmd
(download link is at the bottom of the page).