Clean before install (in case of previous version)

Cleaning install folder before install (in case a previous install was present)
pull/90/head
Romain 2022-05-29 15:47:13 +02:00
parent b43b2d9aa7
commit 9cfa54b2de
1 changed files with 4 additions and 1 deletions

View File

@ -164,10 +164,13 @@ function Install-WingetAutoUpdate{
Write-Host "`nInstalling WAU..." -ForegroundColor Yellow Write-Host "`nInstalling WAU..." -ForegroundColor Yellow
try{ try{
#Copy files to location #Copy files to location (and clean old install)
if (!(Test-Path $WingetUpdatePath)){ if (!(Test-Path $WingetUpdatePath)){
New-Item -ItemType Directory -Force -Path $WingetUpdatePath | Out-Null 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 Copy-Item -Path "$PSScriptRoot\Winget-AutoUpdate\*" -Destination $WingetUpdatePath -Recurse -Force -ErrorAction SilentlyContinue
#White List or Black List apps #White List or Black List apps