Skip to content

Commit 605e060

Browse files
committed
Automatic UAC request. Rebased. Release v2.0
1 parent bfd3c82 commit 605e060

File tree

5 files changed

+86
-79
lines changed

5 files changed

+86
-79
lines changed

FH4Fix Services.bat

Lines changed: 0 additions & 32 deletions
This file was deleted.

FH4Fix.bat

Lines changed: 0 additions & 27 deletions
This file was deleted.

ForzaHorizon4.bat

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
@echo off
2+
3+
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
4+
5+
if '%errorlevel%' NEQ '0' (
6+
echo Requesting administrative privileges...
7+
goto UACPrompt
8+
) else ( goto gotAdmin )
9+
10+
:UACPrompt
11+
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
12+
set params = %*:"=""
13+
echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"
14+
15+
"%temp%\getadmin.vbs"
16+
del "%temp%\getadmin.vbs"
17+
exit /B
18+
:gotAdmin
19+
pushd "%CD%"
20+
CD /D "%~dp0"
21+
22+
echo Executing ForzaHorizon4Fix (v2.0) by @paxanddos.
23+
echo If you have any issues please address them to https://github.com/PAXANDDOS/ForzaHorizon4Fix/issues
24+
echo Waiting for Forza Horizon 4 to finally launch and then killing explorer.exe.
25+
26+
net start XboxNetApiSvc
27+
net start XboxGipSvc
28+
net start XblAuthManager
29+
net start XblGameSave
30+
timeout /T 1 /NOBREAK
31+
32+
start /high explorer.exe shell:appsFolder\Microsoft.SunriseBaseGame_8wekyb3d8bbwe!SunriseReleaseFinal
33+
SetLocal EnableExtensions
34+
SetLocal ENABLEDELAYEDEXPANSION
35+
Set game=ForzaHorizon4.exe
36+
timeout /T 60 /NOBREAK
37+
taskkill /f /im explorer.exe
38+
39+
:loop
40+
tasklist | Find /i "%game%" || (goto Else)
41+
:THEN
42+
timeout /T 5 /NOBREAK
43+
goto loop
44+
:ELSE
45+
start explorer.exe
46+
exit

ForzaHorizon4_light.bat

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
@echo off
2+
3+
echo Executing ForzaHorizon4Fix (v2.0) by @paxanddos.
4+
echo If you have any issues please address them to https://github.com/PAXANDDOS/ForzaHorizon4Fix/issues
5+
echo Waiting for Forza Horizon 4 to finally launch and then killing explorer.exe.
6+
7+
start /high explorer.exe shell:appsFolder\Microsoft.SunriseBaseGame_8wekyb3d8bbwe!SunriseReleaseFinal
8+
SetLocal EnableExtensions
9+
SetLocal ENABLEDELAYEDEXPANSION
10+
Set app=ForzaHorizon4.exe
11+
timeout /T 60 /NOBREAK
12+
taskkill /f /im explorer.exe
13+
14+
:loop
15+
tasklist | Find /i "%app%" || (goto Else)
16+
:THEN
17+
timeout /T 5 /NOBREAK
18+
goto loop
19+
:ELSE
20+
start explorer.exe
21+
exit

README.md

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
1+
<p align="center"><img src="https://static.wikia.nocookie.net/logopedia/images/f/f8/Forza_Horizon_4_logo.svg/revision/latest/scale-to-width-down/512?cb=20191202151349" height="70"/></p>
12
<p align="center">
2-
<img src="https://cdn.steamgriddb.com/logo_thumb/0a6b81775eca5ee27b72deef7972375a.png" width="200"/><br>
3-
<img alt="microsoft" src="https://img.shields.io/badge/Microsoft-blue.svg?style=flat&logo=microsoft&logoColor=white" />
4-
<img alt="windows" src="https://img.shields.io/badge/Windows-blue.svg?style=flat&logo=windows&logoColor=white" />
5-
<img alt="batchfile" src="https://img.shields.io/badge/Batch-blue.svg?style=flat&logo=batch&logoColor=white" />
6-
<img alt="forza" src="https://img.shields.io/badge/Forza-blue.svg?style=flat&logo=forza&logoColor=white" />
3+
<img alt="windows" src="https://img.shields.io/badge/Windows-blue.svg?style=flat-square&logo=windows&logoColor=white" />
4+
<img alt="release" src="https://img.shields.io/github/v/release/PAXANDDOS/ForzaHorizon4Fix?style=flat-square" />
5+
<img alt="downloads" src="https://img.shields.io/github/downloads/PAXANDDOS/ForzaHorizon4Fix/total?style=flat-square" />
76
</p>
87
<h2 align="center">Fix for the Forza Horizon 4 Crashes</h2>
98

10-
<p align="center">
11-
Hello! Forza Horizon 4 is known for its crashes, and often it happens because of the explorer. It happened to me too, so I decided to look for a fix.
12-
Found some that stop and launch explorer with the num button and found it uncomfortable. I made a simple batch file that helped me a lot and I'm still using it.
9+
<p>Hey! Forza Horizon 4 is not a perfect game and you may experience some unexpected game crashes. In most cases, this happens due to a running explorer.exe process. (Game from Microsoft crashing because of software from Microsoft, funny, right?)<br>This fix should help you to overcome this issue! <a href="#how-does-it-work">See details.</a>
1310
</p>
1411

15-
<h3>Download</h3>
16-
<ul>
17-
<li><a href="https://github.com/PAXANDDOS/ForzaHorizon4Fix/releases/download/1.0/FH4Fix.bat">FH4Fix.bat</a></li>
18-
<li><a href="https://github.com/PAXANDDOS/ForzaHorizon4Fix/releases/download/1.0/FH4Fix.Services.bat">FH4FixServices.bat</a></li>
19-
</ul>
12+
<h2>:inbox_tray: Downloads</h2>
13+
<b>Preferred version — <a href="https://github.com/PAXANDDOS/ForzaHorizon4Fix/releases/download/2.0/ForzaHorizon4.bat">Download</b></a><br>
14+
Light version — <a href="https://github.com/PAXANDDOS/ForzaHorizon4Fix/releases/download/2.0/ForzaHorizon4_light.bat"><b>Download</b></a>
2015

21-
<h3>So how does it work?</h3>
16+
<h2>:grey_question: How does it work?</h2>
17+
<p>
18+
Download the <b>preferred</b> version above and run the batch file. This version is compatible with Windows 10 Home and Pro editions and should run correctly. If you experienced some difficulties, you may download the light version, it will run the game without requesting admin rights and without services check.<br>
19+
After the batch file starts, it will request admin rights for further operations. It will check for required Xbox services and start them if they're disabled. Then your game will start and after some time explorer.exe process will be killed, it starts as soon as you exit the game.
20+
</p>
2221
<p>
23-
<i>(If you run FH4Fix.bat)</i><br>
24-
First, it starts Forza with high priority.<br>
25-
Then you'll have to wait 50 seconds for the game to finally start. On my PC it starts after around 50 seconds so that's it.<br>
26-
Then the explorer process will be killed, it launches again as soon as you close the game.<br><br>
27-
If this didn't help or you've experienced some errors in-game, try launching FH4Fix Services(run as administrator). It does exactly the same thing, just checks for important Xbox services and starts them before the game.
22+
<b>Warning!</b><br>
23+
This fix is only for the Microsoft Store version of Forza Horizon 4.<br>
24+
Once exlorer.exe is killed, you are not able to switch between different windows (Shift+Tab) and even adjust the volume. If you want to adjust the volume or something else, enter the Ctrl+Alt+Del screen, everything works fine there.
2825
</p>
29-
<i>That's all. It's my first post to GitHub tho, dunno how it works yet.</i>
26+
27+
<h2>:fox_face: Have a great day!</h2>
28+
If you are intrested in my other works, please <a href="https://paxanddos.github.io">visit my website</a>!

0 commit comments

Comments
 (0)