Skip to content

Instantly share code, notes, and snippets.

@zhou9110
Last active October 14, 2019 13:25
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 zhou9110/86581778b0a11c7dfce336a8bd529dc8 to your computer and use it in GitHub Desktop.
Save zhou9110/86581778b0a11c7dfce336a8bd529dc8 to your computer and use it in GitHub Desktop.
Turn on/off auto-hiding taskbar in tablet mode automatically for Windows 10
:: Switch the auto-hide taskbar in tablet mode on and off
:: by overwriting registery via batch script
:: Modified by: zhou9110
:: Modified on: October 14th 2019
::
:: Reference:
:: Originally Created by: Shawn Brink
:: Originally Created on: April 22nd 2016
:: Tutorial:
:: http://www.tenforums.com/tutorials/48127-taskbar-auto-hide-tablet-mode-turn-off-windows-10-a.html
:: Original File:
:: https://www.tenforums.com/attachments/tutorials/76240d1461384444-taskbar-auto-hide-tablet-mode-turn-off-windows-10-a-turn_on_auto-hide_taskbar_in_tablet_mode.bat
:: https://www.tenforums.com/attachments/tutorials/76239d1461384444-taskbar-auto-hide-tablet-mode-turn-off-windows-10-a-turn_off_auto-hide_taskbar_in_tablet_mode.bat
@echo off
REM Configs
SET REGKEY=HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced
SET REGVAL=TaskbarAutoHideInTabletMode
SET DISPLAY_TEXT_ENABLED=Enabled auto-hide in tablet mode
SET DISPLAY_TEXT_DISABLED=Disabled auto-hide in tablet mode
SET TIMEOUT_SECOND=2
REM Query the value in registery
SET TASKBAR_AUTO_HIDE_ENABLED=
FOR /F "tokens=2,*" %%A IN ('REG Query %REGKEY% /V %REGVAL% ^|findstr %REGVAL%') DO (
SET TASKBAR_AUTO_HIDE_ENABLED=%%B
)
REM Checking if the value is set
IF not defined TASKBAR_AUTO_HIDE_ENABLED (
SET TASKBAR_AUTO_HIDE_ENABLED=0
)
IF %TASKBAR_AUTO_HIDE_ENABLED% EQU 0 (
REM Enable Auto-hide in tablet mode
REG ADD %REGKEY% /V %REGVAL% /T REG_DWORD /D 1 /F >NUL
ECHO %DISPLAY_TEXT_ENABLED%
) ELSE (
REM Disable Auto-hide in tablet mode
REG ADD %REGKEY% /V %REGVAL% /T REG_DWORD /D 0 /F >NUL
ECHO %DISPLAY_TEXT_DISABLED%
)
TIMEOUT %TIMEOUT_SECOND% >NUL
REM To kill and restart explorer to take effects
TASKKILL /f /im explorer.exe
START explorer.exe
@zhou9110
Copy link
Author

zhou9110 commented Oct 14, 2019

How to use

Download the Raw file to a local directory.
Then double click the script file to run the script.

How to add it to the Start screen?

  1. Create a shortcut for the script file
  2. Move the shortcut to C:\ProgramData\Microsoft\Windows\Start Menu\Programs (need Administrator privilege)
  3. Then you can find the shortcut in the program list, add it to the Start screen by right click -> Pin to Start

Caution

Beware that the explorer.exe has to be restarted to take effect. Any opened File Explorer window will be closed after the running the script.

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