PowerShell Tutorials

How To Reset Icon Cache in Windows Using PowerShell

Learn how to reset the icon cache in Windows using a PowerShell script. Resolve issues with missing or corrupted icons on your desktop and file explorer with this step-by-step tutorial.


Introduction

The icons you see on your Windows desktop and in File Explorer play a crucial role in providing a visual representation of files, folders, and applications. Sometimes, due to various reasons, these icons can become corrupted or go missing, leading to a less-than-optimal user experience. To resolve such issues, one effective solution is to reset the icon cache. In this article, we will guide you through the process of resetting the icon cache in Windows using a PowerShell script. This method can help you restore missing or corrupted icons, ensuring a more polished and functional desktop environment.

PowerShell-7

Resetting the icon cache can be particularly useful when you notice icons not displaying correctly, appearing as generic placeholders, or completely disappearing. Let’s dive into the steps to accomplish this using PowerShell.

PowerShell Script to Reset Icon Cache

# PowerShell script to reset icon cache in Windows
# Make sure to run this script with administrator privileges

# Define the paths to the icon cache files
$IconCachePaths = @(
    "$env:LOCALAPPDATA\IconCache.db",
    "$env:LOCALAPPDATA\Microsoft\Windows\Explorer\iconcache*"
)

# Attempt to kill and delete each icon cache file
foreach ($path in $IconCachePaths) {
    Get-ChildItem -Path $path -ErrorAction SilentlyContinue | ForEach-Object {
        try {
            Remove-Item $_.FullName -Force -ErrorAction Stop
            Write-Output "Removed icon cache file: $($_.FullName)"
        } catch {
            Write-Output "Failed to remove icon cache file: $($_.FullName)"
        }
    }
}

# Restart the Windows Explorer process
Get-Process explorer | Stop-Process -Force

# Optionally, the script could restart Explorer automatically, but it often restarts on its own
Start-Process explorer.exe

Write-Output "Icon cache reset. Please check if the issue is resolved after everything reloads."

Steps to Follow

  1. Press Win + X on your keyboard and choose “Windows Terminal (Admin)” or “Command Prompt (Admin)” to open an elevated command prompt.
  2. Copy and paste the provided PowerShell script into the command prompt window.
  3. Press Enter to execute the script. This will stop the Windows Explorer process, delete the IconCache.db file, and then restart the Windows Explorer process.

Conclusion

Resetting the icon cache in Windows using a PowerShell script is a straightforward solution to resolve issues related to missing or corrupted icons. By following the steps outlined in this article, you can quickly refresh the icon cache, leading to a more visually appealing and functional desktop and file explorer experience. If you’ve been facing icon-related problems on your Windows machine, give this method a try, and you’ll likely see a significant improvement in your system’s icon display.

I hope this article was helpful! You can find more here: Windows Articles


Discover more from Patrick Domingues

Subscribe to get the latest posts sent to your email.

author avatar
Patrick Domingues

Leave a Comment

Stay Informed

Receive instant notifications when new content is released.