Skip to content

Instantly share code, notes, and snippets.

@Malix-off
Last active October 18, 2022 18:04
Show Gist options
  • Save Malix-off/9a1fbeb53e86048efbc135f84af31dfb to your computer and use it in GitHub Desktop.
Save Malix-off/9a1fbeb53e86048efbc135f84af31dfb to your computer and use it in GitHub Desktop.
Lenovo Fn And Function Keys Indicator Switch

Problem

In windows, the Lenovo Fn And Function Keys Indicator service tends to be annoying, and it's difficulty removable

Solution

This scripts permits your to toggle the Lenovo Fn And Function Keys Indicator service easily and efficiently

Steps

Links

@echo off
:Initialisation
title Lenovo Fn and Function Keys Indicators
:Administrator_Permission
REM Complying with Administrator Permissions
:Check
REM Trying Running an Action Requiring Administrative Permissions, Then Store its Standard Error Output, OS-Dynamically
if "%PROCESSOR_ARCHITECTURE%" equ "amd64" (
>nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system"
) else (
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
)
:Condition
REM If the Previous Header Catch an Error, it means that Runtime Does Not Have Administrative Permissions
if '%errorlevel%' NEQ '0' (
echo This script requires administrative privileges.
echo.
echo Requesting administrative privileges...
goto UAC_Prompt
) else (
goto Got_Admin
)
:UAC_Prompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params= %*
echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params:"=""%", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /b
:Got_Admin
pushd "%cd%"
cd /d "%~dp0"
:Main
:Prompt
echo Do you want to Enable or Disable the Lenovo Fn and Function Keys Indicators?
:Choice
echo.
set /p choice="Input "Enable" or "Disable" : "
echo.
:Check
if /i "%choice%" equ "Disable" (
echo Disabling Lenovo Fn and Function Keys Indicators...
echo.
call "Service.bat" "disabled"
) else (
if /i "%choice%" equ "Enable" (
echo Enabling Lenovo Fn and Function Keys Indicators...
echo.
call "Service.bat" "auto"
) else (
echo "Choice not correct, back to choice"
echo.
pause
cls
goto Prompt
)
)
:Confirmation
echo Done
echo.
:End
pause
set service="LenovoFnAndFunctionKeys"
set start="%~1"
sc config %service% start= %start% >nul
if %start% equ "disabled" (
sc stop %service% >nul
) else (
sc start %service% >nul
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment