forked from firewire10000/windowsUpdateLoopFix
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcleanup.cmd
More file actions
93 lines (81 loc) · 2.43 KB
/
cleanup.cmd
File metadata and controls
93 lines (81 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
@echo off
REM NAME: Windows Update Loop Fix
REM VERSION: 5.1
REM BUILD DATE: 28 April 2020
REM AUTHOR: aakkam22
REM EDITOR: firewire10000
REM Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params = %*:"=""
echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B
:gotAdmin
pushd "%CD%"
CD /D "%~dp0"
call :setWindow
goto cleanup
REM Function to set the window properties
:setWindow
title Windows Update Loop Fix
mode con cols=80 lines=40
goto :eof
REM Function to print header
:printHeader
cls
echo.
echo %screen%
title title Windows Update Loop Fix - %screen%
echo.
goto :eof
:cleanup
set screen=Cleanup
call :printHeader
echo The script is deleting leftover files...
rmdir %systemdrive%\packages\3020369 /s /q >nul 2>&1
rmdir %systemdrive%\packages\3172605 /s /q >nul 2>&1
del /q %systemdrive%\packages\3020369.msu >nul 2>&1
del /q %systemdrive%\packages\3172605.msu >nul 2>&1
del /q %systemdrive%\packages\wua.exe >nul 2>&1
del /q %systemdrive%\packages\updates.cmd >nul 2>&1
del /q %systemdrive%\packages\master.cmd >nul 2>&1
goto summary
:summary
set screen=Summary
call :printHeader
echo The script has finished running. You can now check for Windows Updates.
echo.
echo Please be patient when checking for updates for the first time.
echo Windows Update might still be registering brand new components.
echo.
echo NOTE: A DISM.EXE log for the update installations was created at:
echo.
echo. "%systemdrive%\install.log"
echo.
echo Please choose an option:
echo.
echo. +-------------------------------+
echo. ^| ^|
echo. ^| [1] Open Windows Update ^|
echo. ^| [2] Go to GitHub Repository ^|
echo. ^| [3] Exit ^|
echo. ^| ^|
echo. +-------------------------------+
choice /c 123 /n
if %errorlevel% EQU 3 goto quit
if %errorlevel% EQU 2 start https://github.com/aakkam22/windowsUpdateLoopFix && goto :summary
if %errorlevel% EQU 1 start wuapp.exe && goto :sumarry
:quit
SETLOCAL >nul 2>&1
SET someOtherProgram=SomeOtherProgram.exe >nul 2>&1
TASKKILL /IM "%someOtherProgram%" >nul 2>&1
DEL "%~f0" >nul 2>&1
exit