Windows: Setting Different Icons for .ini and .xml Files

Abstract: Assign distinct icons to .ini and .xml files in Windows by editing the registry DefaultIcon subkeys for each file class.

Created: 2026-08-03 by

To assign distinct icons to .ini and .xml files in Windows, you must modify the system registry rather than using folder options. This approach changes the default icon for the entire file class, ensuring every instance of these extensions displays the correct visual indicator immediately without manual per-file adjustments.

Understanding File Class Associations

Windows manages file type appearances through the Registry Editor. Each extension like .ini or .xml is linked to a specific file class. For example, .xml files are often associated with classes like XMLFile or applications such as Notepad or Visual Studio Code depending on your default handler. The visual icon displayed by Explorer is stored under the DefaultIcon subkey of that file class. Changing this value updates the icon for all files of that type system-wide.

This method is superior to creating shortcuts because it affects the actual file representation in any folder view, search results, and dialog boxes. It provides a consistent user experience across the operating system. If you previously attempted to change icons via right-click properties, you likely only changed the shortcut target, which does not alter the base file type appearance. We will fix this by directly editing the registry keys responsible for rendering these icons.

Preparing Custom Icon Files

Before modifying the registry, you need valid .ico files for your desired icons. Windows Explorer requires native icon format files; it does not support .png, .jpg, or other raster formats directly for file type associations. You can create these using tools like IcoFX, Greenfish Icon Editor, or online converters.

  • Select Appropriate Icons: Choose one icon for .ini files and a different one for .xml files. Ensure they are visually distinct to aid quick identification.
  • Save Location: Store these .ico files in a permanent directory where you will not delete them later. A good practice is to create a folder named C:\CustomIcons or place them within your user profile's application data folder. If you move or delete the icon file after registration, Windows will revert to the default generic icon.
  • Note the Full Path: Write down the exact full path to each icon file (e.g., C:\CustomIcons\ini_icon.ico). You will need to paste these paths into the registry editor.

Editing the Registry for .ini Files

We will start by assigning a custom icon to .ini files. Open the Run dialog by pressing Win + R, type regedit, and press Enter. Confirm any User Account Control prompts. Navigate to the following key:

HKEY_CLASSES_ROOT\.ini

Look at the (Default) value on the right pane. This contains the name of the file class, such as inifile or System.IniFile. Note this name exactly. Next, navigate to the parent key of that class name. For example, if the default value is inifile, go to:

HKEY_CLASSES_ROOT\inifile

If the DefaultIcon subkey does not exist, right-click the class key, select New > Key, and name it DefaultIcon. Double-click the (Default) value inside this new key. In the Value data field, enter the full path to your .ini icon file followed by a comma and the index number 0. The syntax must be:

"C:\Path\To\Your\ini_icon.ico",0

The quotes are necessary if the path contains spaces. The ,0 indicates the first icon resource in the file. Click OK to save. Repeat this process for the .xml files by finding their associated class name (often XMLFile) and updating its DefaultIcon entry similarly.

Refreshing the Icon Cache

Changes made to the registry do not always appear instantly in File Explorer due to caching. To force Windows to reload the icon definitions, you must clear the icon cache. The most reliable method is to restart the computer. However, you can also manually rebuild the cache by opening Task Manager, ending the explorer.exe process, and then starting it again via File > Run new task > explorer.

After refreshing, navigate to a folder containing both .ini and .xml files. You should now see the distinct icons you assigned. If the old icons persist, ensure that no group policy or third-party shell extension is overriding your settings. For more advanced customization, some users prefer scripting these changes, similar to how one might Opt in Microsoft Automatic Updates using PowerShell for system configuration tasks.

Troubleshooting Common Issues

If the icons do not change, verify that the registry path matches the file class name exactly. Case sensitivity matters in some registry operations. Also, check that the icon file is not corrupted. Sometimes, Windows Defender or antivirus software may block registry modifications; temporarily disabling real-time protection can help diagnose this.

Another common issue arises when multiple applications claim the same file type. If you install a new text editor that sets itself as the default for .xml, it may overwrite your custom icon setting. You may need to re-apply the registry edit after major software installations. This is a standard behavior for system-wide file associations.

Restoring Default Icons

To revert to the original Windows icons, simply delete the DefaultIcon subkey from the respective file class keys in the registry. Alternatively, you can set the (Default) value of DefaultIcon to an empty string. Windows will automatically fall back to the built-in icon for that file type. Always remember to backup your registry before making extensive changes, although this specific tweak is low-risk.

Frequently Asked Questions

Can I use PNG files instead of ICO files?

No, Windows Explorer only accepts native .ico files for file type icons. PNG images cannot be used directly in the registry DefaultIcon value. You must convert your PNG to an ICO format using an image editor or converter tool before applying it.

Why did my custom icon disappear after a Windows Update?

Major Windows updates sometimes reset file associations or clear the icon cache aggressively. While the registry entries usually remain intact, the cache might need to be rebuilt. Restarting your computer typically resolves this. If the registry values were cleared, you will need to re-enter the paths.

How do I find the correct file class name for an extension?

Open the Registry Editor and navigate to HKEY_CLASSES_ROOT. Find the key matching your extension (e.g., .xml). The (Default) value of this key contains the ProgID or file class name. Use this name to navigate to the next level in the registry tree.

Will this affect how the files open?

No, changing the icon does not alter the default application associated with the file. It only changes the visual representation in Explorer. The file will still open with whatever program you have set as the default handler for that extension.

Is there a safer way to do this without editing the registry?

There is no native GUI setting in Windows Folder Options to change icons per file type globally. Third-party software exists, but they ultimately perform the same registry edits. Using the Registry Editor is the safest native method as it involves direct manipulation of known system keys without installing external executables.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More