BleachBit supports several kind of variables for use in writing cleaning rules.
It is a best practice to use variables rather than hard-coding paths that vary
across systems. Common paths may change depending on user logged in, the version
of Windows, and on the user’s language. For example, the Windows
is usually on the
C: drive, but on some systems it is on the
Use variables in any part of CleanerML and Winapp2.ini that refers to a file path.
~ to refer to the user’s profile directory. While this is a
Unix convention, BleachBit supports it also on Windows.
Use any environment variables defined in the operating system.
On Unix systems, BleachBit supports the styles
It is a best practice to use the XDG Base Directory Specification.
On Windows, BleachBit supports the Unix-style above and the Windows-style
The most common Windows environment variables are
%UserProfile%. For more information, see Wikipedia’s article “Environment variable”.
Defined by BleachBit
In addition to the environment variables defined by the operating system, BleachBit defines enviroment variables for convenience and compatability.
On Linux, these variables are defined if they do not exist:
On Windows, the following are defined if they do not exist:
cd: current directory
%ProgramFiles% can behave in an unexpected way because 64-bit
Windows will modify it for 32-bit applications, and BleachBit is a 32-bit
application. To refer to the 64-bit folder on 64-bit Windows, use
instead. For more information, see Microsoft’s article “WOW64 Implementation Details”.
For compatibility with Winapp2.ini, BleachBit expands
%ProgramW6432% as if both were written. Likewise, BleachBit expands
%CommonProgramW6432%. This expansion is not
supported in CleanerML.
BleachBit 2.2 introduces to CleanerML a feature called multi-value variables. Within each cleaner, a variable can be defined with multiple values. This greatly simplifies the development and maintenance of cleaners with path variations for operating system and for application derivatives such as Google Chrome and Chromium.
The syntax to use a multi-value variable is
$$foo$$ on both Linux and Windows. Multi-value variable names are case-sensitive, and values can contain environment variables. See the Adobe Flash cleaner (
flash.xml) for a basic example.
BleachBit 3.0 introduces default variables on Windows
$$ProgramFiles$$expands to both