From 9cfa54b2de5615278caf06cda6ff6170f0ed7425 Mon Sep 17 00:00:00 2001 From: Romain <96626929+Romanitho@users.noreply.github.com> Date: Sun, 29 May 2022 15:47:13 +0200 Subject: [PATCH] Clean before install (in case of previous version) Cleaning install folder before install (in case a previous install was present) --- Winget-AutoUpdate-Install.ps1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Winget-AutoUpdate-Install.ps1 b/Winget-AutoUpdate-Install.ps1 index c81707f..fc12c72 100644 --- a/Winget-AutoUpdate-Install.ps1 +++ b/Winget-AutoUpdate-Install.ps1 @@ -164,10 +164,13 @@ function Install-WingetAutoUpdate{ Write-Host "`nInstalling WAU..." -ForegroundColor Yellow try{ - #Copy files to location + #Copy files to location (and clean old install) if (!(Test-Path $WingetUpdatePath)){ New-Item -ItemType Directory -Force -Path $WingetUpdatePath | Out-Null } + else { + Remove-Item -Path "$WingetUpdatePath\*" -Recurse -Force + } Copy-Item -Path "$PSScriptRoot\Winget-AutoUpdate\*" -Destination $WingetUpdatePath -Recurse -Force -ErrorAction SilentlyContinue #White List or Black List apps