Skip to content

Instantly share code, notes, and snippets.

@roxlu roxlu/focus.bar
Created Oct 6, 2016

Embed
What would you like to do?
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
You can’t perform that action at this time.