Skip to content

Instantly share code, notes, and snippets.

@zhou9110
Created October 14, 2019 13:02
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/1d0f730269118c5fb43b9a6e4ea261cb to your computer and use it in GitHub Desktop.
Save zhou9110/1d0f730269118c5fb43b9a6e4ea261cb to your computer and use it in GitHub Desktop.
一键开启/隐藏Windows 10平板模式的任务栏
:: Switch the auto-hide taskbar in tablet mode on and off
:: by overwriting registery via batch script
:: Modified by: zhou9110 (Github: zhou9110, Zhihu: @周兲子)
:: Modified on: October 14th 2019
:: Version No.: V1.0
::
:: 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 Declare to use code page UTF-8
chcp 65001 >NUL
SET REGKEY=HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced
SET REGVAL=TaskbarAutoHideInTabletMode
SET DISPLAY_TEXT_ENABLED=自动隐藏任务栏功能已开启
SET DISPLAY_TEXT_DISABLED=自动隐藏任务栏功能已关闭
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

下载运行方法:

点击Download ZIP下载压缩包,解压缩之后双击运行

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