Create Enable GamesDows V2

This commit is contained in:
jazir5 2024-06-19 23:25:08 -07:00 committed by GitHub
parent 8cda0e813f
commit c5b1597401
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

192
Enable GamesDows V2 Normal file
View File

@ -0,0 +1,192 @@
@echo off
SETLOCAL EnableExtensions EnableDelayedExpansion
:: Define Steam folder path
SET "STEAM_FOLDER=C:\Program Files (x86)\Steam"
:: Check if Steam is installed
IF NOT EXIST "%STEAM_FOLDER%\Steam.exe" (
echo Steam is not installed. Downloading and installing Steam...
:: Define download URL
SET "STEAM_INSTALLER_URL=https://steamcdn-a.akamaihd.net/client/installer/SteamSetup.exe"
:: Download Steam installer
echo Downloading Steam installer...
powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $url='%STEAM_INSTALLER_URL%'; $path='%TEMP%\SteamSetup.exe'; Invoke-WebRequest $url -OutFile $path; Start-Process -FilePath $path -ArgumentList '/S' -Wait"
:: Check if Steam was installed
IF NOT EXIST "%STEAM_FOLDER%\Steam.exe" (
echo Steam installation failed. Please install Steam manually.
pause
exit /b 1
)
)
echo Steam installed successfully!
:: Define script names and paths
SET "SCRIPT_NAME=DelayedExplorerStart.bat"
SET "SCRIPT_PATH=%STEAM_FOLDER%\%SCRIPT_NAME%"
SET "EXPLORER_PATH=C:\Windows\explorer.exe"
:: Create the DelayedExplorerStart.bat script in the Steam folder
echo Creating DelayedExplorerStart.bat script
(
echo @echo off
echo ^:: Check if user is logged on
echo query user ^| find /i "%USERNAME%" ^>nul
echo if ERRORLEVEL 1 exit
echo ^:: Set Shell back to Explorer
echo REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /t REG_SZ /d "%EXPLORER_PATH%" /f
echo timeout /t 20 /nobreak ^>nul
echo start C:\Windows\explorer.exe
echo timeout /t 10 /nobreak ^>nul
echo REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /t REG_SZ /d "%STEAM_PATH%" /f
) > "%SCRIPT_PATH%"
:: Create VBScript to run the batch file silently
echo Creating RunBatchSilently.vbs script
SET "VBS_NAME=RunBatchSilently.vbs"
SET "VBS_PATH=%STEAM_FOLDER%\%VBS_NAME%"
(
echo Set WshShell = CreateObject("WScript.Shell")
echo WshShell.Run chr(34^) ^& "%SCRIPT_PATH%" ^& chr(34^), 0, True
echo Set WshShell = Nothing
) > "%VBS_PATH%"
:: Create XML file for the scheduled task
SET "XML_PATH=%STEAM_FOLDER%\DelayedExplorerStartTask.xml"
echo Creating DelayedExplorerStartTask.xml
(
echo ^<?xml version="1.0" encoding="UTF-16"?^>
echo ^<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"^>
echo ^<RegistrationInfo^>
echo ^<Date^>2020-01-01T00:00:00^</Date^>
echo ^<Author^>%USERNAME%^</Author^>
echo ^<Description^>Run DelayedExplorerStart.bat at logon.^</Description^>
echo ^</RegistrationInfo^>
echo ^<Triggers^>
echo ^<LogonTrigger^>
echo ^<Enabled^>true^</Enabled^>
echo ^</LogonTrigger^>
echo ^</Triggers^>
echo ^<Principals^>
echo ^<Principal id="Author"^>
echo ^<UserId^>%USERNAME%^</UserId^>
echo ^<LogonType^>InteractiveToken^</LogonType^>
echo ^<RunLevel^>HighestAvailable^</RunLevel^>
echo ^</Principal^>
echo ^</Principals^>
echo ^<Settings^>
echo ^<MultipleInstancesPolicy^>IgnoreNew^</MultipleInstancesPolicy^>
echo ^<DisallowStartIfOnBatteries^>false^</DisallowStartIfOnBatteries^>
echo ^<StopIfGoingOnBatteries^>false^</StopIfGoingOnBatteries^>
echo ^<AllowHardTerminate^>true^</AllowHardTerminate^>
echo ^<StartWhenAvailable^>true^</StartWhenAvailable^>
echo ^<RunOnlyIfNetworkAvailable^>false^</RunOnlyIfNetworkAvailable^>
echo ^<IdleSettings^>
echo ^<StopOnIdleEnd^>true^</StopOnIdleEnd^>
echo ^<RestartOnIdle^>false^</RestartOnIdle^>
echo ^</IdleSettings^>
echo ^<Enabled^>true^</Enabled^>
echo ^<Hidden^>false^</Hidden^>
echo ^<WakeToRun^>false^</WakeToRun^>
echo ^<ExecutionTimeLimit^>PT72H^</ExecutionTimeLimit^>
echo ^<Priority^>7^</Priority^>
echo ^</Settings^>
echo ^<Actions Context="Author"^>
echo ^<Exec^>
echo ^<Command^>wscript.exe^</Command^>
echo ^<Arguments^>"%VBS_PATH%"^</Arguments^>
echo ^</Exec^>
echo ^</Actions^>
echo ^</Task^>
) > "%XML_PATH%"
:: Delete the existing scheduled task if it exists
echo Deleting existing scheduled task if it exists
schtasks /delete /tn "RunDelayedExplorerStart" /f
:: Create the scheduled task using the XML file
echo Creating the scheduled task using the XML file
schtasks /create /tn "RunDelayedExplorerStart" /xml "%XML_PATH%"
:: Additional configurations and optimizations
echo Registry modifications and other optimizations...
:: Enable automatic logon
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 1 /f
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /t REG_SZ /d "%USERNAME%" /f
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword /t REG_SZ /d "" /f
:: Disable the boot UI
bcdedit.exe -set {globalsettings} bootuxdisabled on
:: Disable Logon UI
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DisableLogonUI /t REG_DWORD /d 1 /f
:: Disable Visual Effects
reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v VisualEffects /t REG_DWORD /d 3 /f
:: Increase File System Performance
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem" /v NtfsDisableLastAccessUpdate /t REG_DWORD /d 1 /f
:: Disable Fast Startup to ensure changes take effect
powercfg -h off
:: Disable the lock screen (effective for Enterprise/Education)
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Personalization" /v NoLockScreen /t REG_DWORD /d 1 /f
:: Set the logon background to black by setting a custom background
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\System" /v DisableLogonBackgroundImage /t REG_DWORD /d 1 /f
:: Create the backgrounds folder if it doesn't exist
if not exist "C:\Windows\System32\oobe\info\backgrounds" (
mkdir "C:\Windows\System32\oobe\info\backgrounds"
)
:: Generate a black image using PowerShell
powershell -command "Add-Type -AssemblyName System.Drawing; $width = 1920; $height = 1080; $bitmap = New-Object System.Drawing.Bitmap $width, $height; $graphics = [System.Drawing.Graphics]::FromImage($bitmap); $black = [System.Drawing.Brushes]::Black; $graphics.FillRectangle($black, 0, 0, $width, $height); $bitmap.Save('C:\Windows\System32\oobe\info\backgrounds\backgroundDefault.jpg', [System.Drawing.Imaging.ImageFormat]::Jpeg); $graphics.Dispose(); $bitmap.Dispose();"
:: Set the custom black background image for the lock screen
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Personalization" /v LockScreenImage /t REG_SZ /d "C:\Windows\System32\oobe\info\backgrounds\backgroundDefault.jpg" /f
:: Do not display last signed-in user name
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v DontDisplayLastUserName /t REG_DWORD /d 1 /f
:: Do not display the username and other information during sign-in
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v DontDisplayLockedUserId /t REG_DWORD /d 3 /f
:: Disable Windows animations during sign-in
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v DisableStatusMessages /t REG_DWORD /d 1 /f
:: Disable verbose status messages
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v VerboseStatus /t REG_DWORD /d 0 /f
:: Disable the Welcome screen and reduce animation delay
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v DelayedDesktopSwitchTimeout /t REG_DWORD /d 0 /f
:: Disable lock screen transitions
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\System" /v DisableLockScreenAppNotifications /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\System" /v DisableLogonUIAnimations /t REG_DWORD /d 1 /f
:: Disable Startup Delay
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Serialize" /f
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Serialize" /v StartupDelayInMSec /t REG_DWORD /d 0 /f
:: Improve Windows Explorer Process Priority
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\explorer.exe\PerfOptions" /v CpuPriorityClass /t REG_DWORD /d 3 /f
:: Adjust Large System Cache
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v LargeSystemCache /t REG_DWORD /d 1 /f
:: Enable No GUI Boot
bcdedit /set {current} quietboot on
echo Registry modifications are complete.
echo Steam Big Picture set as default shell.
echo Automatic logon enabled.
echo Boot UI disabled.
pause