confOS/windows11-lite.bat
2025-07-07 20:42:51 +02:00

232 lines
9.5 KiB
Batchfile

@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
SET "repo=https://git.mylloon.fr/Anri/confOS/raw/branch/main"
SET "local=%HOMEPATH%\Documents\Local"
SET "startmenu=%APPDATA%\Microsoft\Windows\Start Menu\Programs"
SET "iwa=-UserAgent 'confOS'"
MKDIR "!local!" 2>NUL
:: => NO-ADMIN RIGHTS <=
fltmc >NUL 2>&1 || (
ECHO Please wait until the administrator popup appears.
@REM :: === Update winget to latest version ==
@REM PowerShell -Command "" ^
@REM "Invoke-WebRequest !iwa! -Uri https://aka.ms/getwinget -OutFile winget.msixbundle;" ^
@REM "Add-AppPackage -ForceApplicationShutdown .\winget.msixbundle;" ^
@REM "del .\winget.msixbundle"
:: === Scripts from ./windows directory ==
PowerShell -Command "Invoke-WebRequest !iwa! -Uri !repo!/windows/update.bat -OutFile '!local!\update.bat'"
PowerShell -Command "Invoke-WebRequest !iwa! -Uri !repo!/windows/clean.bat -OutFile '!local!\ctmpf.bat'"
PowerShell -Command "Invoke-WebRequest !iwa! -Uri !repo!/windows/installers/spotify.bat -OutFile '!local!\blockthespot.bat'"
PowerShell -Command "Invoke-WebRequest !iwa! -Uri !repo!/windows/installers/vencord.bat -OutFile '!local!\vencord_installer.bat'"
PowerShell -Command "Invoke-WebRequest !iwa! -Uri !repo!/windows/reg_fixes.bat -OutFile '!local!\reg_fixes.bat'"
@REM PowerShell -Command "Invoke-WebRequest !iwa! -Uri !repo!/windows/fix_nvidia_wsl.bat -OutFile '!local!\fix_nvidia_wsl.bat'"
@REM PowerShell -Command "Invoke-WebRequest !iwa! -Uri !repo!/windows/start_obs_as_shadowplay.bat -OutFile '%LOCALAPPDATA%\start_obs_as_shadowplay.bat'"
:: === Install Spotify ==
DEL "%APPDATA%\Spotify"
:: Use already downloaded script
ECHO Y| CMD /c "!local!\blockthespot.bat" yes
PowerShell -Command "Stop-Process -Name Spotify -ErrorAction SilentlyContinue"
:: Start as administrator
PowerShell Start -Verb RunAs "%0 noskipadmin" 2>NUL || (
EXIT 1
)
EXIT 0
)
:: => ADMIN RIGHTS <=
IF NOT "%1"=="noskipadmin" (
ECHO You have to run the script as normal user first.
PAUSE
EXIT 0
)
:: === Spotify
:: Defender exclusion
PowerShell -Command "Add-MpPreference -ExclusionPath '%APPDATA%\Spotify'"
:: === Registery modifications ==
CMD /c "!local!\reg_fixes.bat" yes
:: === WinGet ==
:: Auto accept ToT
ECHO Y | winget list >NUL
SET "pmi=winget install --silent --exact"
:: C++ libraries
SET ^"cpp_libs=^
Microsoft.VCRedist.2005.x86 Microsoft.VCRedist.2005.x64 ^
Microsoft.VCRedist.2008.x86 Microsoft.VCRedist.2008.x64 ^
Microsoft.VCRedist.2010.x86 Microsoft.VCRedist.2010.x64 ^
Microsoft.VCRedist.2012.x86 Microsoft.VCRedist.2012.x64 ^
Microsoft.VCRedist.2013.x86 Microsoft.VCRedist.2013.x64 ^
Microsoft.VCRedist.2015+.x86 Microsoft.VCRedist.2015+.x64"
ECHO C++ libraries...
for %%i in (!cpp_libs!) do (
!pmi! %%i
)
:: .NET libraries
SET ^"net_libs=^
Microsoft.DotNet.DesktopRuntime.3_1 Microsoft.DotNet.SDK.3_1 ^
Microsoft.DotNet.DesktopRuntime.5 Microsoft.DotNet.SDK.5 ^
Microsoft.DotNet.DesktopRuntime.6 Microsoft.DotNet.SDK.6 ^
Microsoft.DotNet.DesktopRuntime.7 Microsoft.DotNet.SDK.7 ^
Microsoft.DotNet.DesktopRuntime.8 Microsoft.DotNet.SDK.8"
ECHO .NET libraries...
for %%i in (!net_libs!) do (
!pmi! %%i
)
:: Applications
SET ^"apps=^
Mozilla.Firefox M2Team.NanaZip Parsec.Parsec sylikc.JPEGView KDE.Kdenlive ^
voidtools.Everything.Lite CodecGuide.K-LiteCodecPack.Standard GIMP.GIMP ^
Microsoft.VisualStudioCode Bitwarden.Bitwarden OBSProject.OBSStudio ^
TheDocumentFoundation.LibreOffice Armin2208.WindowsAutoNightMode ^
Xournal++.Xournal++ Microsoft.PowerToys KDE.KDEConnect th-ch.YouTubeMusic ^
OpenWhisperSystems.Signal Microsoft.PowerShell Obsidian.Obsidian ^
Vendicated.Vencord"
ECHO Apps...
for %%i in (!apps!) do (
!pmi! %%i
)
SET ^"games=^
RiotGames.LeagueOfLegends.EUW RiotGames.Valorant.EU molenzwiebel.Deceive"
ECHO Games...
for %%i in (!games!) do (
!pmi! %%i
)
:: === Install WSL ==
ECHO WSL...
wsl --install --no-distribution
:: === Activate Windows ==
:: https://massgrave.dev/command_line_switches#uses-in-powershell-one-liner
PowerShell -Command "" ^
"& ([ScriptBlock]::Create((irm https://get.activated.win )))" ^
"/HWID"
:: === Modules for Windows Update ==
PowerShell -Command "Install-PackageProvider -Name NuGet -Force"
PowerShell -Command "Install-Module -Name PSWindowsUpdate -Force"
:: === LosslessCut ==
PowerShell -Command "Invoke-WebRequest !iwa! -Uri !repo!/windows/installers/losslesscut.bat -OutFile '%TEMP%\losslesscut.bat'"
CMD /c "%TEMP%\losslesscut.bat" yes
:: === DSR ==
PowerShell -Command "Invoke-WebRequest !iwa! -Uri !repo!/windows/installers/dsr.bat -OutFile '%TEMP%\dsr.bat'"
CMD /c "%TEMP%\dsr.bat" yes
:: === OpenTabletDriver ==
ECHO OpenTabletDriver...
PowerShell -Command "" ^
"$archive = '%TEMP%\OpenTabletDriver.win-x64.zip';" ^
"Invoke-WebRequest !iwa! -Uri https://github.com/OpenTabletDriver/OpenTabletDriver/releases/latest/download/OpenTabletDriver.win-x64.zip -OutFile $archive;" ^
"Expand-Archive -Path $archive -DestinationPath '%ProgramFiles%\OpenTabletDriver' -Force;" ^
"$WshShell = New-Object -comObject WScript.Shell;" ^
"$Shortcut = $WshShell.CreateShortcut('!startmenu!\OpenTabletDriver.lnk');" ^
"$Shortcut.TargetPath = '%ProgramFiles%\OpenTabletDriver\OpenTabletDriver.UX.Wpf.exe';" ^
"$Shortcut.WorkingDirectory = '%ProgramFiles%\OpenTabletDriver';" ^
"$Shortcut.Save();" ^
"Remove-Item -Force $archive"
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTabletDriver" /f /v DisplayName /t REG_SZ /d "OpenTabletDriver"
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTabletDriver" /f /v InstallLocation /t REG_SZ /d "%ProgramFiles%\OpenTabletDriver"
:: WindowsInk for OpenTabletDriver
ECHO WindowsInk support for OpenTabletDriver...
PowerShell -Command "Invoke-WebRequest !iwa! -Uri https://github.com/X9VoiD/vmulti-bin/releases/download/v1.0/VMulti.Driver.zip -OutFile '%TEMP%\VMulti-Driver.zip'"
PowerShell -Command "Expand-Archive -Path '%TEMP%\VMulti-Driver.zip' -DestinationPath '%TEMP%\VMulti-Driver' -Force"
CALL "%TEMP%\VMulti-Driver\install_hiddriver.bat"
PowerShell -Command "Invoke-WebRequest !iwa! -Uri https://github.com/X9VoiD/VoiDPlugins/releases/latest/download/WindowsInk.zip -OutFile '%TEMP%\WindowsInk.zip'"
PowerShell -Command "Expand-Archive -Path '%TEMP%\WindowsInk.zip' -DestinationPath '%LOCALAPPDATA%\OpenTabletDriver\Plugins\Windows Ink' -Force"
:: Presets of OpenTabletDriver
ECHO Downloading OpenTabletDriver presets...
MKDIR "%LOCALAPPDATA%\OpenTabletDriver\Presets" 2>NUL
PowerShell -Command "Invoke-WebRequest !iwa! -Uri !repo!/opentabletdriver/vertical-win-main.json -OutFile '%LOCALAPPDATA%\OpenTabletDriver\Presets\vertical-main.json'"
PowerShell -Command "Invoke-WebRequest !iwa! -Uri !repo!/opentabletdriver/vertical-win-second.json -OutFile '%LOCALAPPDATA%\OpenTabletDriver\Presets\vertical-second.json'"
:: Settings of OpenTabletDriver, using 'vertical-main.json' as default settings
ECHO Setting up OpenTabletDriver...
XCOPY "%LOCALAPPDATA%\OpenTabletDriver\Presets\vertical-main.json" "%LOCALAPPDATA%\OpenTabletDriver\settings.json" /-I /Y
:: Start minimized at startup
PowerShell -Command "" ^
"$WshShell = New-Object -comObject WScript.Shell;" ^
"$Shortcut = $WshShell.CreateShortcut('!startmenu!\Startup\OpenTabletDriver.lnk');" ^
"$Shortcut.TargetPath = '%ProgramFiles%\OpenTabletDriver\OpenTabletDriver.UX.Wpf.exe';" ^
"$Shortcut.WorkingDirectory = '%ProgramFiles%\OpenTabletDriver';" ^
"$Shortcut.WindowStyle = 7;" ^
"$Shortcut.Save()"
:: === NOWT ==
PowerShell -Command "Invoke-WebRequest !iwa! -Uri !repo!/windows/installers/nowt.bat -OutFile '%TEMP%\nowt.bat'"
CMD /c "%TEMP%\nowt.bat" yes
:: === Firefox configuration ==
:: Open and close Firefox for the first time, generating a profile
"%ProgramFiles%\Mozilla Firefox\firefox.exe"
TIMEOUT 5
TASKKILL /im firefox.exe /F
ECHO Firefox configuration...
FOR /F "usebackq delims=" %%i IN (`dir /B /S "%APPDATA%\Mozilla\Firefox\Profiles\*.default-release"`) DO SET "vbc=%%i"
PowerShell -Command "Invoke-WebRequest !iwa! -Uri !repo!/.mozilla/firefox/user.js -OutFile '!vbc!\user.js'"
:: Download addons settings in "Download" folder
PowerShell -Command "Invoke-WebRequest !iwa! -Uri !repo!/.mozilla/firefox/extensions/SponsorBlockConfig.json -OutFile '%HOMEPATH%\Downloads\SponsorBlockConfig.json'"
PowerShell -Command "Invoke-WebRequest !iwa! -Uri !repo!/.mozilla/firefox/extensions/auto-tab-discard-preferences.json -OutFile '%HOMEPATH%\Downloads\auto-tab-discard-preferences.json'"
ECHO Configuration files for Firefox Addons are in the download folder (%HOMEPATH%\Downloads).
:: === WindowsAutoNightMode ==
ECHO WindowsAutoNightMode configuration...
MKDIR "%APPDATA%\AutoDarkMode" 2>NUL
PowerShell -Command "Invoke-WebRequest !iwa! -Uri !repo!/.config/WindowsAutoNightMode/config.yaml -OutFile '%APPDATA%\AutoDarkMode\config.yaml'"
"%LOCALAPPDATA%\Programs\AutoDarkMode\adm-app\AutoDarkModeApp.exe"
:: === Drivers notice ==
ECHO Installs drivers, for a list of drivers, use UserDiag https://userdiag.com/download
ECHO For GPU driver uninstallation, use DDU. For NVidia GPU driver isntallation, use NVC.
:: === End message ==
ECHO ""
ECHO About WSL, look at this: https://github.com/yuk7/ArchWSL/releases
ECHO ""
ECHO Take a look at your Windows settings, after you've done all the updates available on your PC.
ECHO Lastly, restart the computer.
PAUSE
EXIT /B