: nply/dwhkd

commit 02ea8692368f974074650eb42e4ba3dc4ce0e0d3
parent 86bab7b6907b7029df81f1b88f4048fe39a88287
Author: theSoberSobber <akshatshrivastava0010@gmail.com>
Date: Mon, 4 Dec 2023 11:59:30 +0530

add toggleWinKey, startup, remove-startup script
3 files changed, 65 insertions(+), 0 deletions(-)
A
remove-startup.bat
|
19
+++++++++++++++++++
A
startup.bat
|
19
+++++++++++++++++++
A
toggleWinKey.bat
|
27
+++++++++++++++++++++++++++
diff --git a/remove-startup.bat b/remove-startup.bat
@@ -0,0 +1,19 @@
+@echo off
+set /p "username=Enter your username: "
+
+REM Check if the username variable is not empty
+if not "%username%"=="" (
+    REM Remove files from the destination folder
+    del "C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\VirtualDesktopAccessor.dll" /f /q
+    del "C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\sxhkd-win32.exe" /f /q
+
+    if %errorlevel% equ 0 (
+        echo Files removed successfully from the Startup folder for user %username%.
+    ) else (
+        echo Error: Unable to remove files from the Startup folder.
+    )
+) else (
+    echo Error: Username cannot be empty.
+)
+
+pause
diff --git a/startup.bat b/startup.bat
@@ -0,0 +1,19 @@
+@echo off
+set /p "username=Enter your username: "
+
+REM Check if the username variable is not empty
+if not "%username%"=="" (
+    REM Copy files to the destination folder
+    copy "VirtualDesktopAccessor.dll" "C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
+    copy "sxhkd-win32.exe" "C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
+
+    if %errorlevel% equ 0 (
+        echo Files copied successfully to Startup folder for user %username%.
+    ) else (
+        echo Error: Unable to copy files to Startup folder.
+    )
+) else (
+    echo Error: Username cannot be empty.
+)
+
+pause
diff --git a/toggleWinKey.bat b/toggleWinKey.bat
@@ -0,0 +1,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