How to exclude files, folders, and Registry keys in CCleaner for Windows

Excluding files, folders, and Registry keys from cleaning:

This page explains how you can exclude any of these three items using ExcludeKey commands in INI files and goes into some technical information on this topic, including coding. If you're not familiar with coding, this page may not be suitable for you. Here is the full list of the topics covered: 

  • Using the ExcludeKey command
  • The format the ExcludeKey string uses for INI files

Note: The contents of this page are aimed at advanced users of our app and may require a certain level of technical knowledge and expertise.

Using the ExcludeKey command: 

You can exclude files, folders, and Registry keys using entries (in INI) when you operate CCleaner using the ExcludeKey command.

The format the ExcludeKey string uses for INI files:


(Note the "|" in-between)

  • X is a positive whole number. You can add as many entries as you need as long as the numbers don't repeat (for example, ExcludeKey1, ExcludeKey2, and so on).
  • The TYPE must either be PATH (to exclude folders), FILE (to exclude specific files), or REG (to exclude Registry entries).
  • You must either specify the PATH, PATH and FILENAME, or REGISTRY KEY, depending on the type of content you want to exclude.
  • You can only use the FILE switch to exclude a single file. To exclude multiple files of the same type, use the PATH switch and specify an extension (for example, *.txt). To exclude multiple files of different types, use a different ExcludeKey entry for each file.

Example 1


This excludes all of the log files with the pattern *-*-*-*.* in the \system32\LogFiles\SCM\ folder of your Windows directory.

Example 2


This excludes the myfile.txt file located in the \system32\LogFiles folder of your Windows directory.

Example 3


This excludes the key located at HKCU\software\piriform (and any subentries).

Example 4


This excludes the files located in the C:\temp folder and all subfolders.

Example 5


This excludes files (of the .exe type) and .bat in the C:\Windows folder.

Note: CCleaner uses ExcludeX (not ExcludeKeyX) as a variable to represent your user settings within the Options > Exclude part of the app. ExcludeX appears in ccleaner.ini when you set it to save settings in that INI file. Do not modify references to ExcludeX or IncludeX.

Need to find your product license key?

Go to our license lookup page and enter your registered email address to retrieve info about your products, including product download links, license key(s), and expiry dates.

Send me my license details

Articles in this section