confOS/windows/installers/fivem.bat

31 lines
1 KiB
Batchfile
Raw Permalink Normal View History

2024-07-02 12:15:42 +02:00
@ECHO OFF
2024-09-25 13:44:45 +02:00
SETLOCAL ENABLEDELAYEDEXPANSION
2024-07-02 12:15:42 +02:00
:: Start as administrator
fltmc >NUL 2>&1 || (
PowerShell Start -Verb RunAs '%0' 2>NUL || (
EXIT 1
)
EXIT 0
)
2024-09-25 13:44:45 +02:00
SET "fivem=%LOCALAPPDATA%\FiveM"
MKDIR !fivem! 2>NUL
2024-07-02 12:15:42 +02:00
ECHO FiveM...
PowerShell -Command "" ^
"$baselink = 'https://runtime.fivem.net/client';" ^
"$exe = 'FiveM.exe';" ^
2024-09-25 13:44:45 +02:00
"$outFile = Join-Path -Path '!fivem!' -ChildPath $exe;" ^
2024-07-02 12:15:42 +02:00
"Invoke-WebRequest -Uri \"https://runtime.fivem.net/client/$exe\" -OutFile $outFile;" ^
"$WshShell = New-Object -comObject WScript.Shell;" ^
"$Shortcut = $WshShell.CreateShortcut('%APPDATA%\Microsoft\Windows\Start Menu\Programs\FiveM.lnk');" ^
2024-09-25 13:44:45 +02:00
"$Shortcut.WorkingDirectory = '!fivem!';" ^
2024-07-02 12:15:42 +02:00
"$Shortcut.TargetPath = $outFile;" ^
"$Shortcut.Save()"
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\fivem" /f /v DisplayName /t REG_SZ /d "FiveM"
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\fivem" /f /v InstallLocation /t REG_SZ /d "%LOCALAPPDATA%\FiveM"
IF NOT "%1"=="yes" PAUSE
EXIT /B