From fcd9d0da9011fcef76feee847f724ac258c5f134 Mon Sep 17 00:00:00 2001 From: Raphire <9938813+Raphire@users.noreply.github.com> Date: Wed, 5 Jun 2024 19:53:59 +0200 Subject: [PATCH] Fixed issue with explorer not restarting in some cases (#67) --- Win11Debloat.ps1 | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/Win11Debloat.ps1 b/Win11Debloat.ps1 index 2922037..cf299b5 100644 --- a/Win11Debloat.ps1 +++ b/Win11Debloat.ps1 @@ -367,7 +367,7 @@ function RegImport { } -# Stop & Restart the Windows explorer process +# Restart the Windows explorer process function RestartExplorer { Write-Output "> Restarting Windows explorer to apply all changes. Note: This may cause some flickering." @@ -375,15 +375,7 @@ function RestartExplorer { # Restarting explorer from a 32bit Powershell window will fail on a 64bit OS if ([Environment]::Is64BitProcess -eq [Environment]::Is64BitOperatingSystem) { - Start-Sleep 0.1 - - taskkill /f /im explorer.exe - - Start-Sleep 0.3 - - Start-Process explorer.exe - - Write-Output "" + Stop-Process -processName: Explorer -Force } else { Write-Warning "Unable to restart Windows Explorer, please manually restart your PC to apply all changes." @@ -1185,6 +1177,7 @@ else { RestartExplorer + Write-Output "" Write-Output "" Write-Output "" Write-Output "Script completed successfully!"