Created
August 26, 2023 19:28
-
-
Save Kartones/fde023c0e6af12d4f9977f068835c755 to your computer and use it in GitHub Desktop.
Win 10 Disable Automatic App Updates.bat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:checkPrivileges | |
NET FILE 1>NUL 2>NUL | |
if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges ) | |
:getPrivileges | |
if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges) | |
setlocal DisableDelayedExpansion | |
set "batchPath=%~0" | |
setlocal EnableDelayedExpansion | |
ECHO Set UAC = CreateObject^("Shell.Application"^) > "%temp%\OEgetPrivileges.vbs" | |
ECHO args = "ELEV " >> "%temp%\OEgetPrivileges.vbs" | |
ECHO For Each strArg in WScript.Arguments >> "%temp%\OEgetPrivileges.vbs" | |
ECHO args = args ^& strArg ^& " " >> "%temp%\OEgetPrivileges.vbs" | |
ECHO Next >> "%temp%\OEgetPrivileges.vbs" | |
ECHO UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs" | |
"%SystemRoot%\System32\WScript.exe" "%temp%\OEgetPrivileges.vbs" %* | |
exit /B | |
:gotPrivileges | |
if '%1'=='ELEV' shift /1 | |
setlocal & pushd . | |
cd /d %~dp0 | |
:Start | |
for /f "delims= " %%a in ('"wmic useraccount where name='%username%' get sid"') do ( | |
if not "%%a"=="SID" ( | |
set myvar=%%a | |
goto :loop_end | |
) | |
) | |
:loop_end | |
set "line01=Windows Registry Editor Version 5.00" | |
set "line02=" | |
set "line03=[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsStore\WindowsUpdate]" | |
set "line04="AutoDownload"=dword:00000002" | |
set "line05=" | |
setlocal EnableDelayedExpansion | |
( | |
echo !line01! | |
echo/ | |
echo !line03! | |
echo !line04! | |
echo/ | |
) > "Win 10 Auto App Updates deactivate.reg" | |
REGEDIT.EXE /S "%~dp0Win 10 Auto App Updates deactivate.reg" | |
del /F /Q "%~dp0Win 10 Auto App Updates deactivate.reg" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment