Tags: #home-automation #scripting # Manipulating Windows in Batch Scripts [[Nircmd]] has a lot of useful utilities to use for window manipulation. ## Win Usage: ``` win [action] [find] [window to find] [Additional Parameters] ``` Documentation: [NirCmd Command Reference - win](https://nircmd.nirsoft.net/win.html) ### Bring Window to Front For [action] parameter use "activate" to bring a window to the front (so that it is visible and on top of other windows). Example: ``` nircmd.exe win activate process "Spotify.exe" ``` ### Find Window For the [find] parameter, you can look up a window in a number of different ways: #### Process This uses the name of the process. It can be found under "Process name" in Task Manager. It is most useful when the Title of the window changes based on what you have open, especially when the process name is unique and you don't typically have multiple windows open for that application. ``` process "name_of_executable.exe" ``` #### Title This use the Title you see at the top of the window. It can be seen in your taskbar or under "Name" in Task Manager. It is most useful when the window has a fixed Title that never changes, especially when the process name might not uniquely identify the window you are trying to find. ``` title "Plex Media Player" ```