Skip to content

Instantly share code, notes, and snippets.

@roxlu
Created October 6, 2016 15:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roxlu/9b203d73be370466e873c25c1c8360dc to your computer and use it in GitHub Desktop.
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)
: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