Created
October 6, 2016 15:09
-
-
Save roxlu/9b203d73be370466e873c25c1c8360dc to your computer and use it in GitHub Desktop.
Script to focus application (Windows 10 shows taskbar when application starts) (source: http://stackoverflow.com/questions/8266840/focus-a-batch-started-application)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:start | |
call :focus "Title of Window" | |
timeout /t 10 /nobreak > NUL | |
goto start | |
::exit /b | |
:focus | |
setlocal EnableDelayedExpansion | |
if ["%~1"] equ [""] ( | |
echo Please give the window's title. | |
exit /b | |
) | |
set pr=%~1 | |
set pr=!pr:"=! | |
echo CreateObject("wscript.shell").appactivate "!pr!" > "%tmp%\focus.vbs" | |
call "%tmp%\focus.vbs" | |
del "%tmp%\focus.vbs" | |
goto :eof | |
endlocal |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment