confOS/windows11.bat

262 lines
13 KiB
Batchfile

@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
SET "repo=https://git.mylloon.fr/Anri/confOS/raw/branch/main"
:: Executed as normal user
MKDIR %HOMEPATH%\Documents\Local 2>NUL
fltmc >NUL 2>&1 || (
:: === Install Spotify ==
PowerShell -Command "Invoke-WebRequest -Uri !repo!/windows/blockthespot.bat -OutFile '%HOMEPATH%\Documents\Local\blockthespot.bat'"
DEL "%APPDATA%\Spotify"
ECHO Y| CMD /c "%HOMEPATH%\Documents\Local\blockthespot.bat" yes
PowerShell -Command "Stop-Process -Name Spotify -ErrorAction SilentlyContinue"
:: Start as administrator
PowerShell Start -Verb RunAs '%0' 2>NUL || (
EXIT 1
)
EXIT 0
)
:: Executed as admin user
:: === Right click of Windows 10 ==
REG ADD "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve
:: === Disabling widgets ==
REG ADD "HKLM\Software\Policies\Microsoft\Dsh" /v AllowNewsAndInterests /t REG_DWORD /d 0 /f
:: === Disabling hibernation (prevents computer to really shutdown) ==
REG ADD "HKLM\System\CurrentControlSet\Control\Session Manager\Power" /v HiberbootEnabled /t REG_DWORD /d 0 /f
powercfg /H off
:: === Disabling the SysMain service (preload some apps in memory) ==
sc stop "SysMain" & sc config "SysMain" start=disabled
:: === Added confirmation when trashing ==
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v ConfirmFileDelete /t REG_DWORD /d 1 /f
:: === Don't create a Zone:Identify ==
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Attachments" /v SaveZoneInformation /t REG_DWORD /d 1 /f
:: === Disables memory integrity ==
:: see https://support.microsoft.com/en-us/windows/options-to-optimize-gaming-performance-in-windows-11-a255f612-2949-4373-a566-ff6f3f474613
REG ADD "HKLM\System\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity" /v Enabled /t REG_DWORD /d 0 /f
:: === Disables sticky keys ==
REG ADD "HKCU\Control Panel\Accessibility\StickyKeys" /v Flags /t REG_SZ /d 506 /f
:: === Inverts the default shortcuts for changing input language and keyboard layout ==
REG ADD "HKCU\Keyboard Layout\toggle" /v "Hotkey" /t REG_SZ /d 1 /f
REG ADD "HKCU\Keyboard Layout\toggle" /v "Language Hotkey" /t REG_SZ /d 2 /f
:: === Disable Game Bar ==
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\GameDVR" /v AppCaptureEnabled /t REG_DWORD /d 0 /f
REG ADD "HKCU\System\GameConfigStore" /v GameDVR_Enabled /t REG_DWORD /d 0 /f
:: === Edge tweaks ==
REG ADD "HKLM\Software\Policies\Microsoft\Edge" /v HubsSidebarEnabled /t REG_DWORD /d 0 /f
REG ADD "HKLM\Software\Policies\Microsoft\Edge" /v ShowRecommendationsEnabled /t REG_DWORD /d 0 /f
:: === WinGet ==
:: Auto accept ToT
ECHO Y | winget list >NUL
SET "pmi=winget install -he"
:: 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"
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"
for %%i in (!net_libs!) do (
!pmi! %%i
)
:: Java dev kits
SET ^"java_jdk=^
EclipseAdoptium.Temurin.8.JDK EclipseAdoptium.Temurin.17.JDK"
for %%i in (!java_jdk!) do (
!pmi! %%i
)
:: Applications
SET ^"apps=^
Discord.Discord Mozilla.Firefox 7zip.7zip Valve.Steam ^
voidtools.Everything.Lite VideoLAN.VLC Parsec.Parsec ^
Microsoft.VisualStudioCode GIMP.GIMP File-New-Project.EarTrumpet ^
TheDocumentFoundation.LibreOffice DuongDieuPhap.ImageGlass ^
OBSProject.OBSStudio Xournal++.Xournal++ Microsoft.PowerToys ^
OpenWhisperSystems.Signal HandBrake.HandBrake Front.scrcpy+ ^
KDE.KDEConnect PrismLauncher.PrismLauncher Microsoft.PowerShell ^
Armin2208.WindowsAutoNightMode HeroicGamesLauncher.HeroicGamesLauncher"
for %%i in (!apps!) do (
!pmi! %%i
)
:: Games
SET ^"games=^
Peppy.Osu! RiotGames.LeagueOfLegends.EUW RiotGames.Valorant.EU"
for %%i in (!games!) do (
!pmi! %%i
)
:: === Install WSL ==
wsl --install --no-launch
wsl --unregister Ubuntu
:: === Install Geek Uninstaller ==
PowerShell -Command "" ^
"$archive = '%TEMP%\geek.zip';" ^
"Invoke-WebRequest -Uri https://geekuninstaller.com/geek.zip -OutFile $archive;" ^
"Expand-Archive -Path $archive -DestinationPath '%ProgramFiles%\Geek Uninstaller';" ^
"$WshShell = New-Object -comObject WScript.Shell;" ^
"$Shortcut = $WshShell.CreateShortcut('%APPDATA%\Microsoft\Windows\Start Menu\Programs\Geek Uninstaller.lnk');" ^
"$Shortcut.TargetPath = '%ProgramFiles%\Geek Uninstaller\geek.exe';" ^
"$Shortcut.Save()"
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\geek" /f /v DisplayName /t REG_SZ /d "Geek Uninstaller"
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\geek" /f /v InstallLocation /t REG_SZ /d "%ProgramFiles%\Geek Uninstaller"
:: === Install LosslessCut ==
PowerShell -Command "" ^
"$archive = 'LosslessCut-win-x64.7z';" ^
"$link = 'https://github.com/mifi/lossless-cut/releases/latest/download/' + $archive;" ^
"$outfile = Join-Path -Path $env:TEMP -ChildPath $archive;" ^
"Invoke-WebRequest -Uri $link -OutFile $outfile;" ^
"cd $env:TEMP;" ^
"& $env:ProgramFiles\7-Zip\7z.exe x $archive -o'%ProgramFiles%\LosslessCut';" ^
"$WshShell = New-Object -comObject WScript.Shell;" ^
"$Shortcut = $WshShell.CreateShortcut('%APPDATA%\Microsoft\Windows\Start Menu\Programs\LosslessCut.lnk');" ^
"$Shortcut.TargetPath = '%ProgramFiles%\LosslessCut\LosslessCut.exe';" ^
"$Shortcut.Save()"
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\LosslessCut" /f /v DisplayName /t REG_SZ /d "LosslessCut"
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\LosslessCut" /f /v InstallLocation /t REG_SZ /d "%ProgramFiles%\LosslessCut"
:: === Install DSR ==
PowerShell -Command "" ^
"$archive = '%TEMP%\dsr.zip';" ^
"Invoke-WebRequest -Uri https://git.mylloon.fr/Anri/dsr/releases/download/1.4.0/dsr-win32-x64-1.4.0.zip -OutFile $archive;" ^
"Expand-Archive -Path $archive -DestinationPath '%ProgramFiles%\DSR';" ^
"Move-Item -Path '%ProgramFiles%\DSR\dsr-win32-x64\*' -Destination '%ProgramFiles%\DSR';" ^
"Remove-Item '%ProgramFiles%\DSR\dsr-win32-x64;'"^
"$WshShell = New-Object -comObject WScript.Shell;" ^
"$Shortcut = $WshShell.CreateShortcut('%APPDATA%\Microsoft\Windows\Start Menu\Programs\DSR.lnk');" ^
"$Shortcut.TargetPath = '%ProgramFiles%\DSR\dsr.exe';" ^
"$Shortcut.Save()"
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\dsr" /f /v DisplayName /t REG_SZ /d "DSR"
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\dsr" /f /v InstallLocation /t REG_SZ /d "%ProgramFiles%\DSR"
:: === Firefox configuration ==
"%ProgramFiles%\Mozilla Firefox\firefox.exe"
TIMEOUT 5
TASKKILL /im firefox.exe /F
FOR /F %%i IN ('dir /B /S ^"%APPDATA%\Mozilla\Firefox\Profiles\*.default-release^"') DO SET "vbc=%%i"
PowerShell -Command "Invoke-WebRequest -Uri !repo!/.mozilla/firefox/user.js -OutFile '!vbc!\user.js'"
PowerShell -Command "Invoke-WebRequest -Uri !repo!/.mozilla/firefox/extensions/Dark-Reader-Settings.json -OutFile '%HOMEPATH%\Downloads\Dark-Reader-Settings.json'"
PowerShell -Command "Invoke-WebRequest -Uri !repo!/.mozilla/firefox/extensions/SponsorBlockConfig.json -OutFile '%HOMEPATH%\Downloads\SponsorBlockConfig.json'"
PowerShell -Command "Invoke-WebRequest -Uri !repo!/.mozilla/firefox/extensions/auto-tab-discard-preferences.json -OutFile '%HOMEPATH%\Downloads\auto-tab-discard-preferences.json'"
PowerShell -Command "Invoke-WebRequest -Uri !repo!/.mozilla/firefox/extensions/libredirect-settings.json -OutFile '%HOMEPATH%\Downloads\libredirect-settings.json'"
ECHO La configuration des differents Addons de Firefox est presente dans le dossier %HOMEPATH%\Downloads.
:: === Drivers ==
ECHO Installe les pilotes, pour connaitre la liste des pilotes, utilise UserDiag https://userdiag.com/download
ECHO Pour NVidia, utilise NVC et DDU
:: === W10Privacy ==
PowerShell -Command "Invoke-WebRequest -Uri !repo!/W10Privacy.ini -OutFile '%HOMEPATH%\Downloads\W10Privacy.ini'"
ECHO Ensuite, utilise W10Privacy avec le fichier present dans %HOMEPATH%\Downloads.
PowerShell -Command "" ^
"$archive = '%TEMP%\W10Privacy.zip';" ^
"Invoke-WebRequest -Uri https://www.w10privacy.de/app/download/12302828636/W10Privacy.zip -OutFile $archive;" ^
"Expand-Archive -Path $archive -DestinationPath $env:TEMP;" ^
"$file = $env:TEMP + '\\' + (Get-ChildItem $env:TEMP\W10Privacy*.exe).BaseName + '.exe';" ^
"Start-Process $file /S -NoNewWindow -Wait -PassThru;" ^
"$shortcut = '%APPDATA%\Microsoft\Windows\Start Menu\Programs\W10Privacy.lnk';" ^
"$bytes = [System.IO.File]::ReadAllBytes($shortcut);" ^
"$bytes[0x15] = $bytes[0x15] -bor 0x20;" ^
"[System.IO.File]::WriteAllBytes($shortcut, $bytes)"
:: === Modules ==
PowerShell -Command "Install-PackageProvider -Name NuGet -Force"
PowerShell -Command "Install-Module -Name PSWindowsUpdate -Force"
:: === Scripts ==
PowerShell -Command "Invoke-WebRequest -Uri !repo!/windows/ctmpf.bat -OutFile '%HOMEPATH%\Documents\Local\ctmpf.bat'"
PowerShell -Command "Invoke-WebRequest -Uri !repo!/windows/update.bat -OutFile '%HOMEPATH%\Documents\Local\update.bat'"
PowerShell -Command "Invoke-WebRequest -Uri !repo!/windows/fix_nvidia_wsl.bat -OutFile '%HOMEPATH%\Documents\Local\fix_nvidia_wsl.bat'"
:: PowerShell -Command "Invoke-WebRequest -Uri !repo!/windows/fix_obs_shortcut.bat -OutFile '%HOMEPATH%\Documents\Local\fix_obs_shortcut.bat'"
PowerShell -Command "Invoke-WebRequest -Uri !repo!/windows/vencord_installer.bat -OutFile '%HOMEPATH%\Documents\Local\vencord_installer.bat'"
:: === Install Vencord ==
CMD /c "%HOMEPATH%\Documents\Local\vencord_installer.bat" yes
:: === Install OpenTabletDriver ==
PowerShell -Command "" ^
"Invoke-WebRequest -Uri https://opentabletdriver.net/Release/Download/OpenTabletDriver.win-x64.zip -OutFile '%TEMP%\OpenTabletDriver.win-x64.zip'" ^
"Expand-Archive -Path '%TEMP%\OpenTabletDriver.win-x64.zip' -DestinationPath '%ProgramFiles%\OpenTabletDriver'" ^
"$WshShell = New-Object -comObject WScript.Shell;" ^
"$Shortcut = $WshShell.CreateShortcut('%APPDATA%\Microsoft\Windows\Start Menu\Programs\OpenTabletDriver.lnk');" ^
"$Shortcut.TargetPath = '%ProgramFiles%\OpenTabletDriver\OpenTabletDriver.UX.Wpf.exe';" ^
"$Shortcut.WorkingDirectory = '%ProgramFiles%\OpenTabletDriver';" ^
"$Shortcut.Save()"
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
PowerShell -Command "Invoke-WebRequest -Uri https://github.com/X9VoiD/vmulti-bin/releases/download/v1.0/Driver.zip -OutFile '%TEMP%\Driver-VMulti.zip'"
:: Extract
PowerShell -Command "Expand-Archive -Path '%TEMP%\Driver-VMulti.zip' -DestinationPath '%TEMP%\Driver-VMulti'"
:: Install driver
CALL %TEMP%\Driver-VMulti\64\install_hiddriver.bat
:: Download plugin
PowerShell -Command "Invoke-WebRequest -Uri https://github.com/X9VoiD/VoiDPlugins/releases/latest/download/WindowsInk.zip -OutFile '%TEMP%\WindowsInk.zip'"
:: Extract plugin
PowerShell -Command "Expand-Archive -Path '%TEMP%\WindowsInk.zip' -DestinationPath '%LOCALAPPDATA%\OpenTabletDriver\Plugins\Windows Ink'"
:: === Miscellaneous ==
:: Rename shortcut for Minecraft
RENAME "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Prism Launcher.lnk" Minecraft.lnk
:: :: Startup OBS replay buffer
:: PowerShell -Command "$WshShell = New-Object -COM WScript.Shell;" ^
:: "$Shortcut = $WshShell.CreateShortcut('%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\OBS.lnk');" ^
:: "$Shortcut.TargetPath = '%ProgramFiles%\obs-studio\bin\64bit\obs64.exe';" ^
:: "$Shortcut.WorkingDirectory = '%ProgramFiles%\obs-studio\bin\64bit';" ^
:: "$Shortcut.Arguments = '--disable-missing-files-check --minimize-to-tray " ^
:: "--startreplaybuffer --profile ""ReplayBuffer"""" --scene ""ReplayBuffer""""';" ^
:: "$Shortcut.Save()"
:: :: Default shortcut should start default profile
:: CALL %HOMEPATH%\Documents\Local\fix_obs_shortcut.bat yes
:: :: Allow system to go in sleep mode when OBS is running
:: powercfg -requestsoverride process obs64.exe display system awaymode
:: Setup WindowsAutoNightMode
MKDIR %APPDATA%\AutoDarkMode 2>NUL
PowerShell -Command "Invoke-WebRequest -Uri !repo!/.config/WindowsAutoNightMode/config.yaml -OutFile '%APPDATA%\AutoDarkMode\config.yaml'"
"%LOCALAPPDATA%\Programs\AutoDarkMode\AutoDarkModeApp.exe"
ECHO Fais un tour des parametres Windows, apres avoir fait toutes les mises a jour disponible sur le PC.
ECHO Enfin, redemarre l'ordinateur
PAUSE
EXIT /B