-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtoggleWinKey.bat
27 lines (22 loc) · 969 Bytes
/
toggleWinKey.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
@echo off
>nul 2>&1 net file || goto :notAdmin
REM Continue with the script since it's running as admin
REM Get the current value of the registry key
for /f "tokens=3" %%a in ('reg query "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoWinKeys" 2^>nul ^| findstr /i "NoWinKeys"') do (
set "currentValue=%%a"
)
REM Toggle the value of NoWinKeys
if "%currentValue%"=="0x1" (
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoWinKeys" /t REG_DWORD /d 0 /f >nul
echo The value of NoWinKeys is now 0
) else (
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoWinKeys" /t REG_DWORD /d 1 /f >nul
echo The value of NoWinKeys is now 1
)
echo Please restart your computer for changes to take place
pause
exit /b
:notAdmin
echo This script requires administrative privileges.
echo Please run the script as an administrator.
pause