Docs/Windows/PostInstall/Windows-Tweaks.bat
2024-04-28 17:13:25 +02:00

74 lines
4.7 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 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
echo.
echo All done!
popd