38 Commits

Author SHA1 Message Date
jazir5
18cd022c6a Update Enable GamesDows.bat 2024-07-16 19:19:50 -07:00
jazir5
f9856390eb Update README.md 2024-07-03 23:16:04 -07:00
jazir5
80febfccb4 Update Enable GamesDows.bat 2024-06-29 15:37:54 -07:00
jazir5
3480682dc7 Update Enable GamesDows.bat 2024-06-29 01:20:10 -07:00
jazir5
85e96a2efa Update Enable GamesDows.bat 2024-06-29 01:15:14 -07:00
jazir5
a1def078e9 Update Enable GamesDows.bat 2024-06-29 00:47:38 -07:00
jazir5
d952788a6c Update Enable GamesDows.bat 2024-06-29 00:35:31 -07:00
jazir5
5c20217813 Update Enable GamesDows.bat 2024-06-29 00:32:28 -07:00
jazir5
a9dc4301e7 Update Enable GamesDows.bat 2024-06-29 00:28:19 -07:00
jazir5
9f1ace084b Update Enable GamesDows.bat 2024-06-29 00:04:56 -07:00
jazir5
143f73f5c2 Update Enable GamesDows.bat 2024-06-28 22:02:15 -07:00
jazir5
531da7ee39 Fixed VBS Script creation location 2024-06-28 15:08:02 -07:00
jazir5
72e754faa4 Update Enable GamesDows.bat 2024-06-27 14:10:17 -07:00
jazir5
1780390c80 Updatedscriptcreationfilepath 2024-06-27 13:59:15 -07:00
jazir5
ac114bc5f6 Update Enable GamesDows.bat 2024-06-26 03:58:35 -07:00
jazir5
83eab8cfb7 Removed Windows Education and Enterprise commands 2024-06-25 23:03:42 -07:00
jazir5
ab12c08ce6 Update Disable GamesDows.bat 2024-06-24 02:48:40 -07:00
jazir5
aa142f68fc Rename Enable GamesDows V1.bat to Enable GamesDows.bat 2024-06-22 23:24:20 -07:00
jazir5
636502a654 Delete Enable GamesDows.bat 2024-06-22 23:24:08 -07:00
jazir5
a82e052126 Add files via upload 2024-06-22 23:23:25 -07:00
jazir5
c61f5697bd Update Enable GamesDows.bat 2024-06-22 22:15:39 -07:00
jazir5
cd03f3b816 Update Enable GamesDows.bat 2024-06-22 18:29:51 -07:00
jazir5
73733e5b2d Update Enable GamesDows.bat 2024-06-22 18:25:54 -07:00
jazir5
a4ab3669dd Enable GamesDows.bat 2024-06-22 18:25:46 -07:00
jazir5
abcb0e07db Delete Enable GamesDows V1.bat 2024-06-22 18:25:16 -07:00
jazir5
a631c5cb20 Rename Enable GamesDows Original.bat to Enable GamesDows.bat 2024-06-22 18:24:51 -07:00
jazir5
6dfbecdce9 Add files via upload 2024-06-22 18:24:17 -07:00
jazir5
59e190f499 Delete Enable GamesDows.bat 2024-06-20 01:27:33 -07:00
jazir5
429a799410 Create Enable GamesDows V1.bat 2024-06-20 01:27:19 -07:00
jazir5
43ab18cf33 Delete Testing:Enable GamesDows v2 2024-06-20 01:26:08 -07:00
jazir5
9153e24b96 Delete Enable GamesDows V1 2024-06-20 01:25:54 -07:00
jazir5
9e6b7096d9 Update README.md 2024-06-20 01:20:38 -07:00
jazir5
df6e357429 Update README.md 2024-06-20 01:20:11 -07:00
jazir5
e21fc465cd Create Enable GamesDows V1 2024-06-20 01:19:19 -07:00
jazir5
1dae7faaf8 Update README.md 2024-06-19 23:37:54 -07:00
jazir5
5558beb5d6 Delete WIP C++ executable andvisual studio command line tools installation.bat 2024-06-19 20:53:23 -07:00
jazir5
c604af7631 Delete Installvisualstudiobuildtools.bat 2024-06-19 20:53:15 -07:00
jazir5
374831a04e Merge pull request #1 from jazir555/jazir555-testing
Create Installvisualstudiobuildtools.bat
2024-06-19 18:26:35 -07:00
6 changed files with 7 additions and 508 deletions

View File

@@ -26,10 +26,6 @@ IF EXIST "%XML_PATH%" DEL "%XML_PATH%"
:: Delete the scheduled task
schtasks /delete /tn "RunDelayedExplorerStart" /f
:: Disable automatic logon
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 0 /f
reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword /f
:: Enable the boot UI
bcdedit.exe -set {globalsettings} bootuxdisabled off

View File

@@ -6,7 +6,7 @@ echo Setting Steam Big Picture as default shell
echo Set Steam Big Picture as the default shell
SET "KEY_NAME=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
SET "VALUE_NAME=Shell"
SET "STEAM_PATH=C:\Program Files (x86)\Steam\Steam.exe -bigpicture -silent -nobootstrapupdate -skipinitialbootstrap -skipverifyfiles"
SET "STEAM_PATH=C:\Program Files (x86)\Steam\Steam.exe -bigpicture -nobootstrapupdate -skipinitialbootstrap -skipverifyfiles"
REG ADD "%KEY_NAME%" /v %VALUE_NAME% /t REG_SZ /d "%STEAM_PATH%" /f
@@ -110,11 +110,6 @@ echo Delayed Explorer start script and VBScript created in Steam folder.
echo Scheduled Task added to run the script at logon.
echo XML file for Scheduled Task created.
echo 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
echo Disable the boot UI
bcdedit.exe -set {globalsettings} bootuxdisabled on
@@ -128,46 +123,8 @@ reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v VisualEffects /t REG_DWORD
echo Increase File System Performance
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem" /v NtfsDisableLastAccessUpdate /t REG_DWORD /d 1 /f
@echo off
REM Disable Fast Startup to ensure changes take effect
powercfg -h off
REM Disable the lock screen (effective for Enterprise/Education)
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Personalization" /v NoLockScreen /t REG_DWORD /d 1 /f
REM 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
REM 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"
)
REM 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();"
REM 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
REM 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
REM 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
REM Disable Windows animations during sign-in
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v DisableStatusMessages /t REG_DWORD /d 1 /f
REM Disable verbose status messages
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v VerboseStatus /t REG_DWORD /d 0 /f
REM 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
REM 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
echo Optimize Paging File Performance
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v DisablePagingExecutive /t REG_DWORD /d 1 /f
echo Disable Startup Delay
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Serialize" /f
@@ -180,13 +137,9 @@ reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Mem
echo Enabling No GUI Boot
bcdedit /set {current} quietboot on
PowerShell -Command "Enable-WindowsOptionalFeature -Online -FeatureName 'DeviceLockdown' -All"
PowerShell -Command "Enable-WindowsOptionalFeature -Online -FeatureName 'Custom Logon' -All"
echo Registry modifications are complete.
echo Steam Big Picture set as default shell.
echo Automatic logon enabled.
echo Boot UI disabled.
pause

View File

@@ -1,59 +0,0 @@
@echo off
setlocal enabledelayedexpansion
:: Log file
set log_file=%~dp0modify_winlogon.log
set temp_dir=C:\Temp
set vs_install_log=%temp_dir%\vs_buildtools_install.log
set vs_install_error_log=%temp_dir%\vs_buildtools_install_error.log
echo Script started at %date% %time% > %log_file%
echo Script started at %date% %time%
:: Ensure running as administrator
openfiles >nul 2>&1
if %errorlevel% neq 0 (
echo This script must be run as administrator! >> %log_file%
echo This script must be run as administrator!
pause
exit /b
)
:: Ensure Temp Directory Exists and has Correct Permissions
echo Ensuring temp directory exists and has correct permissions... >> %log_file%
if not exist "%temp_dir%" (
mkdir "%temp_dir%"
)
icacls "%temp_dir%" /grant Everyone:(F) >> %log_file% 2>&1
if %errorlevel% neq 0 (
echo Failed to set permissions for the temp directory. >> %log_file%
pause
exit /b
)
echo Temp directory permissions set. >> %log_file%
:: Download Visual Studio Build Tools Installer
set installer=%temp_dir%\vs_buildtools.exe
echo Downloading Visual Studio Build Tools... >> %log_file%
powershell -Command "Invoke-WebRequest -Uri 'https://aka.ms/vs/16/release/vs_buildtools.exe' -OutFile '%installer%'" >> %log_file% 2>&1
if %errorlevel% neq 0 (
echo Failed to download Visual Studio Build Tools installer. >> %log_file%
pause
exit /b
)
echo Visual Studio Build Tools installer downloaded successfully. >> %log_file%
:: Run Visual Studio Build Tools Installer
echo Running Visual Studio Build Tools installer... >> %log_file%
powershell -Command "Start-Process -Wait -FilePath '%installer%' -ArgumentList '--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --passive --norestart' -RedirectStandardOutput '%vs_install_log%' -RedirectStandardError '%vs_install_error_log%' -NoNewWindow" >> %log_file% 2>&1
if %errorlevel% neq 0 (
echo Failed to install Visual Studio Build Tools. >> %log_file%
echo Check the install log for details: %vs_install_log% and %vs_install_error_log% >> %log_file%
pause
exit /b
)
echo Visual Studio Build Tools installed successfully. >> %log_file%
:: Indicate end of script
echo Script completed successfully. >> %log_file%
pause

View File

@@ -2,6 +2,10 @@ Transform your Windows Computer into a Video Game console first, PC second!
**This script is a WIP. Currently, the main functionality works as intended. Steam Big Picture launches automatically when the OS boots, then explorer starts automatically after a delay, which allows you to exit to desktop via the menu without needing to launch a shortcut for Explorer.exe first.**
**Note: Steam must be installed, you must be signed in to Steam, and finally the Steam Autostart entry in task manager must be disabled/deleted before running the script.**
**This script must be run as admin!**
# GamesDows
The Enable GamesDows batch script makes Windows boot straight into Steam Big Picture without displaying any Explorer UI elements to ensure a Game Console like experience on Windows. I made this because I have a Steam Deck and I want the experience to mirror that of Steam OS as closely as possible. However, this will work on any Windows PC, the commands are not specific to the Steam Deck.

View File

@@ -1,173 +0,0 @@
@echo off
SETLOCAL EnableExtensions
echo Setting Steam Big Picture as default shell
echo Set Steam Big Picture as the default shell
SET "KEY_NAME=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
SET "VALUE_NAME=Shell"
SET "STEAM_PATH=C:\Program Files (x86)\Steam\Steam.exe -bigpicture -silent -nobootstrapupdate -skipinitialbootstrap -skipverifyfiles"
REG ADD "%KEY_NAME%" /v %VALUE_NAME% /t REG_SZ /d "%STEAM_PATH%" /f
@echo off
SETLOCAL EnableExtensions EnableDelayedExpansion
echo Define the default Steam folder path and script names
SET "STEAM_FOLDER=C:\Program Files (x86)\Steam"
SET "SCRIPT_NAME=DelayedExplorerStart.bat"
SET "SCRIPT_NAME1=StartSteamAsAdmin.bat"
SET "SCRIPT_PATH=%STEAM_FOLDER%\%SCRIPT_NAME%"
SET "SCRIPT_PATH1=%STEAM_FOLDER%\%SCRIPT_NAME1%"
SET "SCRIPT_PATH1=%STEAM_FOLDER%\%SCRIPT_NAME%"
SET "EXPLORER_PATH=C:\Windows\explorer.exe"
echo Creating StartSteamAsAdmin.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 Steam As Admin
echo REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /t REG_SZ /d "%STEAM_PATH%" /f
) > "%SCRIPT_PATH1%"
:: Create VBScript to run the batch file silently
@echo off
SET "VBS_NAME1=RunSteamAsAdmin.vbs"
SET "VBS_PATH1=%STEAM_FOLDER%\%VBS_NAME1%"
echo Set WshShell = CreateObject("WScript.Shell") > "%VBS_PATH1%"
echo WshShell.Run chr(34)^&"%SCRIPT_PATH1%"^&chr(34), 0, True >> "%VBS_PATH1%"
echo Set WshShell = Nothing >> "%VBS_PATH1%"
echo Create the DelayedExplorerStart.bat script in the Steam folder
(
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%"
echo %VBS_PATH%
echo Creating RunBatchSilently.vbs script
:: Create VBScript to run the batch file silently
@echo off
SET "VBS_NAME=RunBatchSilently.vbs"
SET "VBS_PATH=%STEAM_FOLDER%\%VBS_NAME%"
echo Set WshShell = CreateObject("WScript.Shell") > "%VBS_PATH%"
echo WshShell.Run chr(34)^&"%SCRIPT_PATH%"^&chr(34), 0, True >> "%VBS_PATH%"
echo Set WshShell = Nothing >> "%VBS_PATH%"
echo Create XML file for the scheduled task
SET XML_PATH=%STEAM_FOLDER%\DelayedExplorerStartTask.xml
echo Delete the existing XML file if it exists
IF EXIST "%XML_PATH%" DEL "%XML_PATH%"
(
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%"
echo Delete the existing scheduled task if it exists
schtasks /delete /tn "RunDelayedExplorerStart" /f
echo Create the scheduled task using the XML file
schtasks /create /tn "RunDelayedExplorerStart" /xml "%XML_PATH%"
echo Delayed Explorer start script and VBScript created in Steam folder.
echo Scheduled Task added to run the script at logon.
echo XML file for Scheduled Task created.
echo 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
echo Disable the boot UI
bcdedit.exe -set {globalsettings} bootuxdisabled on
echo Disable Logon UI
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DisableLogonUI /t REG_DWORD /d 1 /f
echo Disable Visual Effects
reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v VisualEffects /t REG_DWORD /d 3 /f
echo Increase File System Performance
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem" /v NtfsDisableLastAccessUpdate /t REG_DWORD /d 1 /f
echo Optimize Paging File Performance
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v DisablePagingExecutive /t REG_DWORD /d 1 /f
echo 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
echo 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
echo Adjust Large System Cache
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v LargeSystemCache /t REG_DWORD /d 1 /f
echo Enabling No GUI Boot
bcdedit /set {current} quietboot on
PowerShell -Command "Enable-WindowsOptionalFeature -Online -FeatureName 'DeviceLockdown' -All"
PowerShell -Command "Enable-WindowsOptionalFeature -Online -FeatureName 'Custom Logon' -All"
echo Registry modifications are complete.
echo Steam Big Picture set as default shell.
echo Automatic logon enabled.
echo Boot UI disabled.
pause

View File

@@ -1,222 +0,0 @@
@echo off
setlocal enabledelayedexpansion
:: Log file
set log_file=%~dp0modify_winlogon.log
set compile_log=%~dp0compile.log
echo Script started at %date% %time% > %log_file%
:: Ensure running as administrator
openfiles >nul 2>&1
if %errorlevel% neq 0 (
echo This script must be run as administrator! >> %log_file%
echo This script must be run as administrator!
pause
exit /b
)
:: Paths and filenames
set exe_name=CustomLogonUI.exe
set cpp_code=CustomLogonUI.cpp
set src_path=%~dp0
set log_file=%~dp0modify_winlogon.log
set dst_path=C:\Windows\System32
set backup_logonui=logonui_backup.exe
set temp_dir=C:\Temp
set installer=%temp_dir%\vs_buildtools.exe
set vs_install_log=%temp_dir%\vs_buildtools_install.log
set vs_install_error_log=%temp_dir%\vs_buildtools_install_error.log
echo Script started at %date% %time% > %log_file%
echo Script started at %date% %time%
:: Ensure Temp Directory Exists and has Correct Permissions
echo Ensuring temp directory exists and has correct permissions... >> %log_file%
if not exist "%temp_dir%" (
mkdir "%temp_dir%"
)
icacls "%temp_dir%" /grant Everyone:(F) >> %log_file% 2>&1
if %errorlevel% neq 0 (
echo Failed to set permissions for the temp directory. >> %log_file%
pause
exit /b
)
echo Temp directory permissions set. >> %log_file%
:: Step 2: Install .NET Framework 4.8 (NetFx4-AdvSrvs)
echo Installing .NET Framework 4.8 (NetFx4-AdvSrvs)... >> %log_file%
echo Installing .NET Framework 4.8 (NetFx4-AdvSrvs)...
dism /online /enable-feature /featurename:NetFx4-AdvSrvs /All /NoRestart >> %log_file% 2>&1
echo DISM command exit code: %errorlevel% >> %log_file%
if %errorlevel% neq 0 (
echo Failed to install .NET Framework 4.8 (NetFx4-AdvSrvs). >> %log_file%
echo Failed to install .NET Framework 4.8 (NetFx4-AdvSrvs). Check the log for details: %log_file%
exit /b
)
echo .NET Framework 4.8 (NetFx4-AdvSrvs) installed successfully. >> %log_file%
echo .NET Framework 4.8 (NetFx4-AdvSrvs) installed successfully.
:: Step 4: Install Windows SDK
echo Downloading Windows SDK... >> %log_file%
echo Downloading Windows SDK...
powershell -command "Invoke-WebRequest -Uri 'https://go.microsoft.com/fwlink/?linkid=2120843' -OutFile '%sdk_installer%'" >> %log_file% 2>&1
if %errorlevel% neq 0 (
echo Failed to download Windows SDK installer. >> %log_file%
echo Failed to download Windows SDK installer.
exit /b
)
echo Windows SDK installer downloaded successfully. >> %log_file%
echo Windows SDK installer downloaded successfully.
echo Installing Windows SDK... >> %log_file%
echo Installing Windows SDK...
start /wait "" "%sdk_installer%" /Quiet /NoRestart /Features + /InstallPath "%ProgramFiles%\Windows Kits\10" >> %log_file% 2>&1
if %errorlevel% neq 0 (
echo Failed to install Windows SDK. >> %log_file%
echo Failed to install Windows SDK.
exit /b
)
echo Windows SDK installed successfully. >> %log_file%
echo Windows SDK installed successfully.
@echo off
:: Install Visual C++ Redist
echo Downloading Visual C++ Redistributable installers...
:: Create a temporary directory to store the installers
set "TMP_DIR=%TEMP%\vcredist_installers"
mkdir "%TMP_DIR%"
:: Download the latest Visual C++ Redistributable installers
bitsadmin /transfer "VC2015-2022 x64" https://aka.ms/vs/17/release/vc_redist.x64.exe "%TMP_DIR%\VC_redist.x64.exe"
bitsadmin /transfer "VC2015-2022 x86" https://aka.ms/vs/17/release/vc_redist.x86.exe "%TMP_DIR%\VC_redist.x86.exe"
echo Installing Visual C++ Redistributable packages...
:: Install Visual C++ 2015-2022 Redistributable
start /wait "%TMP_DIR%\VC_redist.x64.exe" /install /quiet /norestart
start /wait "%TMP_DIR%\VC_redist.x86.exe" /install /quiet /norestart
echo Visual C++ Redistributable packages installed successfully!
:: Clean up the temporary directory
rmdir /s /q "%TMP_DIR%"
pause
:: Step 6: Download and Install Visual Studio Community Edition
echo Downloading Visual Studio Community Edition... >> %log_file%
echo Downloading Visual Studio Community Edition...
powershell -command "Invoke-WebRequest -Uri 'https://aka.ms/vs/16/release/vs_community.exe' -OutFile '%vs_community_installer%'" >> %log_file% 2>&1
if %errorlevel% neq 0 (
echo Failed to download Visual Studio Community installer. >> %log_file%
echo Failed to download Visual Studio Community installer.
exit /b
)
echo Visual Studio Community installer downloaded successfully. >> %log_file%
echo Visual Studio Community installer downloaded successfully.
echo Installing Visual Studio Community Edition... >> %log_file%
echo Installing Visual Studio Community Edition...
start /wait "" "%vs_community_installer%" --add Microsoft.VisualStudio.Workload.CoreEditor --includeRecommended --passive --norestart --log %vs_install_log% --loglevel verbose
if %errorlevel% neq 0 (
echo Failed to install Visual Studio Community. Check the install log for details: %vs_install_log% >> %log_file%
echo Failed to install Visual Studio Community. Check the install log for details: %vs_install_log%
exit /b
)
echo Visual Studio Community installed successfully. >> %log_file%
echo Visual Studio Community installed successfully.
:: Download Visual Studio Build Tools Installer
set installer=%temp_dir%\vs_buildtools.exe
echo Downloading Visual Studio Build Tools... >> %log_file%
powershell -Command "Invoke-WebRequest -Uri 'https://aka.ms/vs/16/release/vs_buildtools.exe' -OutFile '%installer%'" >> %log_file% 2>&1
if %errorlevel% neq 0 (
echo Failed to download Visual Studio Build Tools installer. >> %log_file%
pause
exit /b
)
echo Visual Studio Build Tools installer downloaded successfully. >> %log_file%
:: Run Visual Studio Build Tools Installer
echo Running Visual Studio Build Tools installer... >> %log_file%
powershell -Command "Start-Process -Wait -FilePath '%installer%' -ArgumentList '--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --passive --norestart' -RedirectStandardOutput '%vs_install_log%' -RedirectStandardError '%vs_install_error_log%' -NoNewWindow" >> %log_file% 2>&1
if %errorlevel% neq 0 (
echo Failed to install Visual Studio Build Tools. >> %log_file%
echo Check the install log for details: %vs_install_log% and %vs_install_error_log% >> %log_file%
pause
exit /b
)
echo Visual Studio Build Tools installed successfully. >> %log_file%
:: Indicate end of script
echo Script completed successfully. >> %log_file%
pause
:: Step 5: Create the C++ source file using PowerShell
echo Creating C++ source file using PowerShell... >> %log_file%
powershell -command "Add-Content -Path '%cpp_code%' -Value '#include <windows.h>'; Add-Content -Path '%cpp_code%' -Value 'int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)'; Add-Content -Path '%cpp_code%' -Value '{'; Add-Content -Path '%cpp_code%' -Value ' return 0;'; Add-Content -Path '%cpp_code%' -Value '}';"
if %errorlevel% neq 0 (
echo Failed to create the C++ source file using PowerShell. >> %log_file%
echo Failed to create the C++ source file using PowerShell.
pause
exit /b
)
echo C++ source file created successfully using PowerShell. >> %log_file%
:: Step 6: Compile the C++ code to create the custom executable
echo Compiling the C++ source file... >> %log_file%
call "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x86 >> %log_file% 2>&1
if %errorlevel% neq 0 (
echo Failed to set up Visual Studio environment. >> %log_file%
echo Failed to set up Visual Studio environment.
pause
exit /b
)
cl %cpp_code% /Fe:%exe_name% /link /SUBSYSTEM:WINDOWS > %compile_log% 2>&1
if %errorlevel% neq 0 (
echo Compilation failed. >> %log_file%
echo Compilation failed. Check the compile.log for details. >> %log_file%
pause
exit /b
)
echo C++ source file compiled successfully. >> %log_file%
:: Step 7: Ensure the custom executable was created
if not exist "%src_path%%exe_name%" (
echo Custom executable %exe_name% not found in %src_path%. >> %log_file%
echo Custom executable %exe_name% not found in %src_path%.
pause
exit /b
)
echo Custom executable found. >> %log_file%
pause
:: Step 8: Backup the original logonui.exe
echo Backing up the original logonui.exe... >> %log_file%
copy "%dst_path%\logonui.exe" "%dst_path%\%backup_logonui%" >> %log_file% 2>&1
if %errorlevel% neq 0 (
echo Failed to backup the original logonui.exe. >> %log_file%
echo Failed to backup the original logonui.exe.
pause
exit /b
)
echo Original logonui.exe backed up successfully. >> %log_file%
pause
:: Step 9: Replace the original logonui.exe with the custom executable
echo Replacing the original logonui.exe with the custom executable... >> %log_file%
copy "%src_path%%exe_name%" "%dst_path%\logonui.exe" >> %log_file% 2>&1
if %errorlevel% neq 0 (
echo Failed to replace logonui.exe. >> %log_file%
echo Failed to replace logonui.exe.
pause
exit /b
)
echo logonui.exe replaced successfully. >> %log_file%
pause
echo All changes applied successfully. Please restart your computer. >> %log_file%
echo All changes applied successfully. Please restart your computer.
pause