From 6aa32df3ad58d632a06230040ebd2adda4ebd532 Mon Sep 17 00:00:00 2001 From: zoicware <118035521+zoicware@users.noreply.github.com> Date: Tue, 9 Dec 2025 16:50:22 -0500 Subject: [PATCH] skip empty paths fix #65 --- RemoveWindowsAi.ps1 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/RemoveWindowsAi.ps1 b/RemoveWindowsAi.ps1 index 3a20dbd..097d098 100644 --- a/RemoveWindowsAi.ps1 +++ b/RemoveWindowsAi.ps1 @@ -1529,7 +1529,13 @@ function Remove-AI-Files { foreach ($keyword in $aiKeyWords) { foreach ($location in $regLocations) { Get-ChildItem $location -Recurse -ErrorAction SilentlyContinue | Where-Object { $_.PSChildName -like "*$keyword*" } | ForEach-Object { - Remove-Item $_.PSPath -Recurse -Force -ErrorAction SilentlyContinue + try { + Remove-Item $_.PSPath -Recurse -Force -ErrorAction Stop + } + catch { + #ignore when path is null + } + } }