Windows Scanning Exclusions: Wildcards and Variables

When you specify the files, folders or processes you want to exclude from scanning, you can use wildcards or variables.

Note Some wildcards or variables cannot be used for exclusions from real-time scanning on Windows XP or Windows Server 2003.
Important Think carefully before you add scanning exclusions because doing so may reduce your protection.

Wildcards

You can use the wildcards shown in this table.

Note Only * and ? can be used on Windows XP and Windows Server 2003.

Token

Matches

Comments

* (Star)

Zero or more of any character except \ or /

** (Star Star)

Zero or more characters including \ and /, when bracketed by \ or / characters or used at the start or end of an exclusion.

Any other use of a ** is treated as a single * and matches zero or more characters excluding \ and /.

For example:

  • c:\foo\**\bar matches: c:\foo\bar, c:\foo\more\bar, c:\foo\even\more\bar
  • **\bar matches c:\foo\bar
  • c:\foo\** matches c:\foo\more\bar
  • c:\foo**bar matches c:\foomorebar but NOT c:\foo\more\bar

\ (Backslash)

Either \ or /

/ (Forward slash)

Either / or \

? (Question mark)

One single character, unless at the end of a string where it can match zero characters.

. (Period)

A period OR the empty string at the end of a filename, if the pattern ends in a period and the filename does not have an extension.

Note that:

  • *.* matches all files
  • *. matches all files without an extension
  • "foo." matches "foo" and" "foo."

Example wildcards

Here are some examples of the use of wildcards.

Expression

Interpreted as

Description

foo

**\foo

Exclude any file named foo (in any location).

foo\bar

**\foo\bar

Exclude any file named bar in a folder named foo (in any location).

*.txt

**\*.txt

Exclude all files named *.txt (in any location).

C:

C:

Exclude drive C: from scanning (including the drive's master boot record).

C:\

C:\

Exclude all files on drive C: from scanning (but scan the drive's master boot record).

C:\foo\

C:\foo\

All files and folders underneath C:\foo, including C:\foo itself.

C:\foo\*.txt

C:\foo\*.txt

All files or folders contained in C:\foo named *.txt

Variables for exclusions

You can use variables when you set up scanning exclusions.

The table below shows the variables and examples of the locations they correspond to on each operating system.

Variable

Windows 7 and later

Windows Server 2008 and later

Windows XP

Windows Server 2003

%allusersprofile%

C:\ProgramData

C:\Documents and Settings\All Users

%appdata%

C:\Users\*\AppData\Roaming

C:\Documents and Settings\*\Application Data

Does not work for real-time scanning.

%commonprogramfiles%

C:\Program Files\Common Files

C:\Program Files\Common Files

%commonprogramfiles(x86)%

C:\Program Files (x86)\Common Files

C:\Program Files (x86)\Common Files

%localappdata%

C:\Users\*\AppData\Local

C:\Documents and Settings\*\Local Settings\Application Data

Does not work for real-time scanning.

%programdata%

C:\ProgramData

C:\Documents and Settings\All Users\Application Data

%programfiles%

C:\Program Files

C:\Program Files

%programfiles(x86)%

C:\Program Files (x86)

C:\Program Files (x86)

%systemdrive%

C:

C:

%systemroot%

C:\Windows

C:\Windows

%temp% or %tmp%

C:\Users\*\AppData\Local\Temp

C:\Documents and Settings\*\Local Settings\Temp

Does not work for real-time scanning.

%userprofile%

C:\Users\*

C:\Documents and Settings\*

%windir%

C:\Windows

C:\Windows