Skip to content

Commit eba399f

Browse files
authored
Remove clean manager, check if winget is installed
1 parent eef5c32 commit eba399f

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

removemsapp.bat

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@echo off
2-
:: V1.4
2+
:: V1.5
33

44

55
::# elevate with native shell by AveYo
@@ -44,7 +44,11 @@ echo Install winget
4444
echo ====================== & echo.
4545

4646
::installing dependies and Winget
47-
powershell -command "$ProgressPreference = 'SilentlyContinue' ; write-host "Downloading and Installing dependies" ; Invoke-WebRequest -Uri https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile .\Microsoft.VCLibs.x64.14.00.Desktop.appx ; Invoke-WebRequest -Uri https://www.nuget.org/api/v2/package/Microsoft.UI.Xaml/2.7.3 -OutFile .\microsoft.ui.xaml.2.7.3.nupkg.zip ; Expand-Archive -Path .\microsoft.ui.xaml.2.7.3.nupkg.zip -Force ; Add-AppXPackage -Path .\microsoft.ui.xaml.2.7.3.nupkg\tools\AppX\x64\Release\Microsoft.UI.Xaml.2.7.appx; Add-AppXPackage -Path .\Microsoft.VCLibs.x64.14.00.Desktop.appx ; write-host "Installing Winget" ; Invoke-WebRequest -Uri https://github.com/microsoft/winget-cli/releases/download/v1.6.2771/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle -OutFile .\MicrosoftDesktopAppInstaller_8wekyb3d8bbwe.msixbundle ; Add-AppXPackage -Path .\MicrosoftDesktopAppInstaller_8wekyb3d8bbwe.msixbundle" 2> nul
47+
:: check if Winget is already installed
48+
winget -v 2> nul
49+
IF %ERRORLEVEL% NEQ 0 (
50+
powershell -command "$ProgressPreference = 'SilentlyContinue' ; write-host "Downloading and Installing dependies" ; Invoke-WebRequest -Uri https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile .\Microsoft.VCLibs.x64.14.00.Desktop.appx ; Invoke-WebRequest -Uri https://www.nuget.org/api/v2/package/Microsoft.UI.Xaml/2.7.3 -OutFile .\microsoft.ui.xaml.2.7.3.nupkg.zip ; Expand-Archive -Path .\microsoft.ui.xaml.2.7.3.nupkg.zip -Force ; Add-AppXPackage -Path .\microsoft.ui.xaml.2.7.3.nupkg\tools\AppX\x64\Release\Microsoft.UI.Xaml.2.7.appx; Add-AppXPackage -Path .\Microsoft.VCLibs.x64.14.00.Desktop.appx ; write-host "Installing Winget" ; Invoke-WebRequest -Uri https://github.com/microsoft/winget-cli/releases/download/v1.6.2771/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle -OutFile .\MicrosoftDesktopAppInstaller_8wekyb3d8bbwe.msixbundle ; Add-AppXPackage -Path .\MicrosoftDesktopAppInstaller_8wekyb3d8bbwe.msixbundle" 2> nul
51+
)
4852

4953
cls & echo ======================
5054
echo Remove packages first stage. Please Wait...
@@ -239,19 +243,9 @@ winget install --id 9MSMLRH6LZF3 --accept-source-agreements --silent --accept-pa
239243

240244

241245
cls
242-
CHOICE /c YN /M "Do you want to run Clean Manager"
243-
if %ERRORLEVEL% == 1 (CALL :sub_Clean)
244-
245246
CHOICE /c YN /M "Do you want to reboot now"
246247
if %ERRORLEVEL% == 1 (shutdown -r -f -t 00)
247248

248249
cls & echo Done. Thank you for using this tool. ==== Reboot is recommended ====& echo.
249250
pause
250251
exit
251-
252-
:sub_Clean
253-
echo Cleanning, Please Wait...
254-
for /f "delims=" %%a in ('REG QUERY HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches /s /k /f *') do (
255-
REG add "%%a" /v "StateFlags0005 " /t REG_DWORD /d 2 /f >nul 2>&1 )
256-
CleanMgr.exe /sagerun:5
257-
exit /B

0 commit comments

Comments
 (0)