Docs/Windows/PostInstall/Windows-Tweaks.bat
2025-06-10 12:58:09 +02:00

132 lines
8.1 KiB
Batchfile

@echo off
net session >nul 2>&1 || (
powershell -c "start cmd -ArgumentList '/c call """%~f0""" %*' -verb runas" >nul 2>&1 || echo This script needs administrative privileges
exit /b
)
pushd %~d0%~p0
echo Show Explorer file extensions.
REG ADD HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v HideFileExt /t REG_DWORD /d 0 /F >nul 2>&1
echo Show hidden files.
REG ADD HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v Hidden /t REG_DWORD /d 1 /F >nul 2>&1
echo Adding context menu Command prompt here and Powershell here
REG ADD HKEY_CLASSES_ROOT\Directory\shell\01MenuCmd /v "MUIVerb" /d "Command Prompts" /F >nul 2>&1
REG ADD HKEY_CLASSES_ROOT\Directory\shell\01MenuCmd /v "Icon" /d "cmd.exe" /F >nul 2>&1
REG ADD HKEY_CLASSES_ROOT\Directory\shell\01MenuCmd /v "ExtendedSubCommandsKey" /d "Directory\ContextMenus\MenuCmd" /F >nul 2>&1
REG ADD HKEY_CLASSES_ROOT\Directory\background\shell\01MenuCmd /v "MUIVerb" /d "Command Prompts" /F >nul 2>&1
REG ADD HKEY_CLASSES_ROOT\Directory\background\shell\01MenuCmd /v "Icon" /d "cmd.exe" /F >nul 2>&1
REG ADD HKEY_CLASSES_ROOT\Directory\background\shell\01MenuCmd /v "ExtendedSubCommandsKey" /d "Directory\ContextMenus\MenuCmd" /F >nul 2>&1
REG ADD HKEY_CLASSES_ROOT\Directory\ContextMenus\MenuCmd\shell\open /v "MUIVerb" /d "Command Prompt" /F >nul 2>&1
REG ADD HKEY_CLASSES_ROOT\Directory\ContextMenus\MenuCmd\shell\open /v "Icon" /d "cmd.exe" /F >nul 2>&1
REG ADD HKEY_CLASSES_ROOT\Directory\ContextMenus\MenuCmd\shell\open\command /d "cmd.exe /s /k pushd ""%%V""" /F >nul 2>&1
REG ADD HKEY_CLASSES_ROOT\Directory\ContextMenus\MenuCmd\shell\runas /v "MUIVerb" /d "Command Prompt Elevated" /F >nul 2>&1
REG ADD HKEY_CLASSES_ROOT\Directory\ContextMenus\MenuCmd\shell\runas /v "Icon" /d "cmd.exe" /F >nul 2>&1
REG ADD HKEY_CLASSES_ROOT\Directory\ContextMenus\MenuCmd\shell\runas /v "HasLUAShield" /d "" /F >nul 2>&1
REG ADD HKEY_CLASSES_ROOT\Directory\ContextMenus\MenuCmd\shell\runas\command /d "cmd.exe /s /k pushd ""%%V""" /F >nul 2>&1
REG ADD HKEY_CLASSES_ROOT\Directory\shell\02MenuPowerShell /v "MUIVerb" /d "PowerShell Prompts" /F >nul 2>&1
REG ADD HKEY_CLASSES_ROOT\Directory\shell\02MenuPowerShell /v "Icon" /d "powershell.exe" /F >nul 2>&1
REG ADD HKEY_CLASSES_ROOT\Directory\shell\02MenuPowerShell /v "ExtendedSubCommandsKey" /d "Directory\ContextMenus\MenuPowerShell" /F >nul 2>&1
REG ADD HKEY_CLASSES_ROOT\Directory\background\shell\02MenuPowerShell /v "MUIVerb" /d "PowerShell Prompts" /F >nul 2>&1
REG ADD HKEY_CLASSES_ROOT\Directory\background\shell\02MenuPowerShell /v "Icon" /d "powershell.exe" /F >nul 2>&1
REG ADD HKEY_CLASSES_ROOT\Directory\background\shell\02MenuPowerShell /v "ExtendedSubCommandsKey" /d "Directory\ContextMenus\MenuPowerShell" /F >nul 2>&1
REG ADD HKEY_CLASSES_ROOT\Directory\ContextMenus\MenuPowerShell\shell\open /v "MUIVerb" /d "PowerShell" /F >nul 2>&1
REG ADD HKEY_CLASSES_ROOT\Directory\ContextMenus\MenuPowerShell\shell\open /v "Icon" /d "powershell.exe" /F >nul 2>&1
REG ADD HKEY_CLASSES_ROOT\Directory\ContextMenus\MenuPowerShell\shell\open\command /d "powershell.exe -noexit -command Set-Location ""%%V""" /F >nul 2>&1
REG ADD HKEY_CLASSES_ROOT\Directory\ContextMenus\MenuPowerShell\shell\runas /v "MUIVerb" /d "PowerShell Elevated" /F >nul 2>&1
REG ADD HKEY_CLASSES_ROOT\Directory\ContextMenus\MenuPowerShell\shell\runas /v "Icon" /d "powershell.exe" /F >nul 2>&1
REG ADD HKEY_CLASSES_ROOT\Directory\ContextMenus\MenuPowerShell\shell\runas /v "HasLUAShield" /d "" /F >nul 2>&1
REG ADD HKEY_CLASSES_ROOT\Directory\ContextMenus\MenuPowerShell\shell\runas\command /d "powershell.exe -noexit -command Set-Location ""%%V""" /F >nul 2>&1
REG ADD HKEY_CLASSES_ROOT\Directory\shell\cmd /v "Extended" /d "" /F >nul 2>&1
REG ADD HKEY_CLASSES_ROOT\Directory\background\shell\cmd /v "Extended" /d "" /F >nul 2>&1
REG ADD HKEY_CLASSES_ROOT\Directory\shell\Powershell /v "Extended" /d "" /F >nul 2>&1
REG ADD HKEY_CLASSES_ROOT\Directory\background\shell\Powershell /v "Extended" /d "" /F >nul 2>&1
echo Enabling numlock during login screen
reg add "HKEY_USERS\.DEFAULT\Control Panel\Keyboard" /v InitialKeyboardIndicators /t REG_SZ /d 2 /f
echo Enabling numlock when logged in
reg add "HKEY_CURRENT_USER\Control Panel\Keyboard" /v InitialKeyboardIndicators /t REG_SZ /d 2 /f
echo Disabling password complexity.
@rem secedit /export /cfg "%cd%\secconfig.cfg"
(
echo [Unicode]
echo Unicode=yes
echo [System Access]
echo MinimumPasswordAge = 0
echo MaximumPasswordAge = -1
echo MinimumPasswordLength = 0
echo PasswordComplexity = 0
echo PasswordHistorySize = 0
echo LockoutBadCount = 0
echo RequireLogonToChangePassword = 0
echo ForceLogoffWhenHourExpire = 0
echo ClearTextPassword = 0
echo LSAAnonymousNameLookup = 0
echo EnableAdminAccount = 1
echo EnableGuestAccount = 0
echo [Version]
echo signature="$CHICAGO$"
echo Revision=1
)>"secconfig.cfg"
secedit /configure /db "%windir%\security\local.sdb" /cfg "%cd%\secconfig.cfg" >nul
del secconfig.cfg
choice /C yn /M "Switch to classic context menus?"
if %ERRORLEVEL% EQU 1 (
echo Switching to classic context menus.
REG ADD HKEY_CURRENT_USER\SOFTWARE\CLASSES\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32 /F >nul 2>&1
taskkill /F /IM explorer.exe & start explorer
)
choice /C yn /M "Disable UAC?"
if %ERRORLEVEL% EQU 1 (
echo Disabling UAC.
REG ADD HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\policies\system /v EnableLUA /t REG_DWORD /d 0 /F >nul 2>&1
echo You must restart the computer before changes are in effect.
)
choice /C yn /M "Disable adds for Windows 10 / Windows 11?"
if %ERRORLEVEL% EQU 1 (
echo Disabling adds
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v Start_IrisRecommendations /t REG_DWORD /d 0 /f >nul 2>&1
:: Disable Start Menu suggestions
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v SystemPaneSuggestionsEnabled /t REG_DWORD /d 0 /f >nul 2>&1
:: Disable lock screen ads (Spotlight)
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v RotatingLockScreenEnabled /t REG_DWORD /d 0 /f >nul 2>&1
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v RotatingLockScreenOverlayEnabled /t REG_DWORD /d 0 /f >nul 2>&1
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v ContentDeliveryAllowed /t REG_DWORD /d 0 /f >nul 2>&1
:: Disable suggestions in Settings
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\UserProfileEngagement" /v ScoobeSystemSettingEnabled /t REG_DWORD /d 0 /f >nul 2>&1
:: Disable tips and tailored experiences
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v SubscribedContent-338393Enabled /t REG_DWORD /d 0 /f >nul 2>&1
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Privacy" /v TailoredExperiencesWithDiagnosticDataEnabled /t REG_DWORD /d 0 /f >nul 2>&1
:: Disable suggested content (apps like Candy Crush)
reg add "HKLM\Software\Policies\Microsoft\Windows\CloudContent" /v DisableConsumerFeatures /t REG_DWORD /d 1 /f >nul 2>&1
:: Disable ads in File Explorer
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v ShowSyncProviderNotifications /t REG_DWORD /d 0 /f >nul 2>&1
:: Disable Windows welcome experience
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v SubscribedContent-310093Enabled /t REG_DWORD /d 0 /f >nul 2>&1
echo Disabling Copilot
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsCopilot" /v TurnOffWindowsCopilot /t REG_DWORD /d 1 /f >nul 2>&1
)
choice /C yn /M "Mimic Windows 10 user interface on Windows 11?"
if %ERRORLEVEL% EQU 1 (
:: Enable classic file explorer look
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell\Update\Packages" /v UndockingDisabled /t REG_DWORD /d 0 /f >nul 2>&1
:: Startmenu to the left
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v TaskbarAl /t REG_DWORD /d 0 /f >nul 2>&1
)
choice /C yn /M "Enable changes by restarting explorer?"
if %ERRORLEVEL% EQU 1 (
taskkill /f /im explorer.exe && start explorer.exe
)
echo.
echo All done!
popd