Skip to content

Instantly share code, notes, and snippets.

@OpossumPetya
Created November 23, 2018 08:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OpossumPetya/c3a44575c7f9e6ded27a09df16550136 to your computer and use it in GitHub Desktop.
Save OpossumPetya/c3a44575c7f9e6ded27a09df16550136 to your computer and use it in GitHub Desktop.
Start IE browser maximized (can be used with automation)
@echo OFF
setlocal ENABLEEXTENSIONS
set IE11Maximized=2C0000000200000003
set KEY_NAME="HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main"
set VALUE_NAME=Window_Placement
:: REG QUERY "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" /v Window_Placement
for /f "usebackq tokens=3" %%A in (`REG QUERY %KEY_NAME% /v %VALUE_NAME% 2^>nul`) do (
set ValueOrig=%%A
)
if not defined ValueOrig goto end
set ValueFirstPart=%ValueOrig:~0,18%
set ValueSecondPart=%ValueOrig:~18%
set ValueFinal=%IE11Maximized%%ValueSecondPart%
@echo Original value = %ValueOrig%
@echo Value to replace = %ValueFirstPart%
@echo Value to keep = %ValueSecondPart%
@echo Final value to write = %ValueFinal%
:: REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" /v Window_Placement /t REG_BINARY /d 2C0000000200000003000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE1000000190000007B07000078030000 /f
REG ADD %KEY_NAME% /v %VALUE_NAME% /t REG_BINARY /d %ValueFinal% /f
:end:
@OpossumPetya
Copy link
Author

This can be used with automation tasks.
It must be executed while IE browser is not running, otherwise the registry value will be overwritten when IE window is closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment