# Variables & Wildcards

<figure><img src="https://762006384-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MJXOXEifAmpyvNVL1to%2Fuploads%2FFh3832Xs83qbZiTuUOrN%2Fimage.png?alt=media&#x26;token=350e6473-6c63-4672-97c9-ad85cfa5f4f3" alt=""><figcaption></figcaption></figure>

**Audience:** IT admins. This page gives **many examples** of **path variables** and **wildcards** in policies, jobs, and paths so you can match applications and folders across users, versions, and install locations.

For the full list of variables and wildcard rules, see [Reference: Variables](/keeperpam/endpoint-privilege-manager/policies/path-variables.md) and [Reference: Wildcards](/keeperpam/endpoint-privilege-manager/policies/wildcards.md).

***

## Quick Reminder

* **Variables:** `{userprofile}`, `{programfiles}`, `{localappdata}`, etc. Resolve to real paths at evaluation time. Use **backslash** (`\`) on Windows and **forward slash** (`/`) on Linux/macOS in patterns.
* **Wildcards:** `*` in an **application path** means “any characters” in that segment. In **folder filters** (Extension.Folders), only **prefix matching** is used—no `*` in the folder path.
* **Combined:** Resolve the variable first, then match; e.g. `{userprofile}\*\*.exe` matches any `.exe` in any subfolder of the user profile.

## Combining Variables and Wildcards

Variables and wildcards can be used **together** in application or file path patterns. The variable is resolved first (e.g. to the user’s profile path), then the `*` matches any characters in that path. This lets one pattern cover many versions or install locations.

**Examples:**

<table data-header-hidden="false" data-header-sticky><thead><tr><th>Pattern</th><th>What it matches</th></tr></thead><tbody><tr><td><code>{userprofile}\AppData\Local\GitHubDesktop\*\resources\app\git\cmd\git.exe</code></td><td>Git shipped with GitHub Desktop, for any version folder (e.g. <code>app-3.2.1</code> or <code>app-3.3.0</code>) under the user’s local AppData.</td></tr><tr><td><code>{localappdata}\*\*\*.exe</code></td><td>Any <code>.exe</code> nested three levels deep under the user’s Local AppData (e.g. per-app versioned folders).</td></tr><tr><td><code>{programfiles}\*\*\*.exe</code></td><td>Any <code>.exe</code> in any subfolder of Program Files (e.g. <code>C:\Program Files\Vendor\Product\bin\app.exe</code>).</td></tr><tr><td><code>{userprofile}\Documents\*\*.pdf</code></td><td>Any PDF in any one-level subfolder of the user’s Documents.</td></tr><tr><td><code>{appdata}\*\*.exe</code></td><td>Any <code>.exe</code> in any one-level subfolder of the user’s Roaming AppData.</td></tr></tbody></table>

**Notes:**

* Use **backslash** (`\`) on Windows and **forward slash** (`/`) on Linux/macOS in patterns when writing OS-specific rules; path variables resolve to the correct separator per platform.
* One `*` matches any characters (including none) in that segment; multiple `*` segments allow multiple variable-depth folders (e.g. version numbers, app names).

## Examples

### 1. Versioned or Install-Variant Apps (one pattern, many versions)

Use a single `*` (or multiple `*` segments) where the path has a version or build folder so one policy covers all versions.

<table data-header-hidden="false" data-header-sticky><thead><tr><th width="348.6666259765625">Pattern</th><th>Use case</th></tr></thead><tbody><tr><td><code>{userprofile}\AppData\Local\GitHubDesktop\*\resources\app\git\cmd\git.exe</code></td><td>Git bundled with GitHub Desktop; <code>*</code> matches version folders like <code>app-3.2.1</code>, <code>app-3.3.0</code>.</td></tr><tr><td><code>{localappdata}\Programs\*\*\*.exe</code></td><td>Apps installed under <code>Local\Programs</code> with vendor/product/version structure.</td></tr><tr><td><code>{programfiles}\Microsoft VS Code\*\Code.exe</code></td><td>VS Code for any installed version folder.</td></tr><tr><td><code>{programfiles}\*\*\bin\*.exe</code></td><td>Any vendor’s <code>bin</code> folder three levels under Program Files.</td></tr><tr><td><code>{programfilesx86}\*\*\*.exe</code></td><td>Any 32-bit app in a three-level subfolder of Program Files (x86).</td></tr></tbody></table>

### 2. User Profile and AppData (per-user paths)

Variables like `{userprofile}`, `{appdata}`, `{localappdata}` resolve to the **requesting user’s** paths. Use them so the same policy works for every user.

<table data-header-hidden="false" data-header-sticky><thead><tr><th width="302">Pattern</th><th>What it matches</th></tr></thead><tbody><tr><td><code>{userprofile}\*.exe</code></td><td>Any <code>.exe</code> directly in the user’s profile folder.</td></tr><tr><td><code>{userprofile}\Documents\*.exe</code></td><td>Any <code>.exe</code> in the user’s Documents.</td></tr><tr><td><code>{userprofile}\Documents\*\*.pdf</code></td><td>Any PDF in any one-level subfolder of Documents.</td></tr><tr><td><code>{appdata}\*\*.exe</code></td><td>Any <code>.exe</code> in any one-level subfolder of Roaming AppData (e.g. <code>AppData\Roaming\Vendor\app.exe</code>).</td></tr><tr><td><code>{localappdata}\*\*\*.exe</code></td><td>Any <code>.exe</code> three levels deep under Local AppData (covers versioned app folders).</td></tr><tr><td><code>{userdesktop}\*.lnk</code></td><td>Any shortcut on the user’s desktop.</td></tr><tr><td><code>{userprofile}\Downloads\*.exe</code></td><td>Any <code>.exe</code> in the user’s Downloads (Windows; use <code>{downloads}</code> on macOS).</td></tr></tbody></table>

### 3. System and Program Files (same for all users)

These resolve to the same path for everyone on the machine. Use them for system tools and installed software.

<table data-header-hidden="false" data-header-sticky><thead><tr><th width="250">Pattern</th><th>What it matches</th></tr></thead><tbody><tr><td><code>{system32}\*.exe</code></td><td>Any executable directly in System32.</td></tr><tr><td><code>{system32}\*\*.exe</code></td><td>Any <code>.exe</code> in any one-level subfolder of System32.</td></tr><tr><td><code>{programfiles}\*\*.exe</code></td><td>Any <code>.exe</code> in any one-level subfolder of Program Files.</td></tr><tr><td><code>{programfiles}\*\*\*.exe</code></td><td>Any <code>.exe</code> in any subfolder up to three levels deep (e.g. <code>Vendor\Product\bin\app.exe</code>).</td></tr><tr><td><code>{programfiles}\*\*\*\*.exe</code></td><td>Deeper vendor/product/version/bin layouts.</td></tr><tr><td><code>{syswow64}\*.exe</code></td><td>32-bit executables in SysWOW64.</td></tr><tr><td><code>{programdata}\*\*.exe</code></td><td>Any <code>.exe</code> in any one-level subfolder of ProgramData.</td></tr></tbody></table>

### 4. Keeper App Paths (plugin and job configs)

Use **application** variables so config works regardless of install directory.

<table data-header-hidden="false" data-header-sticky><thead><tr><th>Pattern or path</th><th>Use case</th></tr></thead><tbody><tr><td><code>{approot}\Plugins\KeeperPolicy\KeeperPolicy.exe</code></td><td>Plugin executable path in a plugin JSON.</td></tr><tr><td><code>{pluginroot}\KeeperPolicy\bin\Release\net8.0\KeeperPolicy</code></td><td>Plugin path using plugin root.</td></tr><tr><td><code>{jobroot}\bin\MyTool\MyTool.exe</code></td><td>Job executable in the Jobs tree.</td></tr><tr><td><code>{approot}\Localization\LocaleValues.json</code></td><td>Path to a locale file in documentation or scripts.</td></tr></tbody></table>

### 5. Folder Filter (Extension.Folders) — prefix only, no `*`

Folder filters use **prefix matching**: “Does the full path **start with** this folder?” You **can** use variables; you **cannot** use wildcards in the folder path (the `*` would be literal).

<table data-header-hidden="false" data-header-sticky><thead><tr><th width="250">Folder value</th><th>Matches</th></tr></thead><tbody><tr><td><code>{downloads}</code></td><td>Every file under the user’s Downloads (and subfolders).</td></tr><tr><td><code>{userprofile}</code></td><td>Every file under the user’s profile.</td></tr><tr><td><code>{documents}</code></td><td>Every file under the user’s Documents.</td></tr><tr><td><code>{desktop}</code> or <code>{userdesktop}</code></td><td>Every file on the user’s desktop and in desktop subfolders.</td></tr><tr><td><code>{programfiles}</code></td><td>Every file under Program Files.</td></tr><tr><td><code>{localappdata}</code></td><td>Every file under the user’s Local AppData.</td></tr></tbody></table>

**Wrong:** `{downloads}\*` — the `*` is treated as a literal character, not “any subfolder.” Use `{downloads}` to mean “all of Downloads.”

### 6. ApplicationCheck + Extension.Folders (combined)

When ApplicationCheck has a **filename pattern** (e.g. `*.exe`) and Extension.Folders is set, the product can build full path patterns. Examples:

<table data-header-hidden="false" data-header-sticky><thead><tr><th width="173">ApplicationCheck</th><th width="168.3333740234375">Extension.Folders</th><th>Effect</th></tr></thead><tbody><tr><td><code>*.exe</code></td><td><code>{userdesktop}</code></td><td>All <code>.exe</code> on the user’s desktop.</td></tr><tr><td><code>*.exe</code></td><td><code>{downloads}</code></td><td>All <code>.exe</code> in the user’s Downloads (and subfolders).</td></tr><tr><td><code>*.pdf</code></td><td><code>{documents}</code></td><td>All PDFs under the user’s Documents.</td></tr><tr><td><code>*.exe</code></td><td><code>{programfiles}</code></td><td>All <code>.exe</code> under Program Files (very broad).</td></tr><tr><td><code>*.exe</code></td><td><code>{localappdata}</code></td><td>All <code>.exe</code> under the user’s Local AppData.</td></tr></tbody></table>

### 7. Linux and macOS

On Linux/macOS use **forward slashes** and the appropriate variables. Many executables have no extension.

<table data-header-hidden="false" data-header-sticky><thead><tr><th width="308">Pattern (Linux/macOS)</th><th>What it matches</th></tr></thead><tbody><tr><td><code>{home}/*</code></td><td>Any file in the user’s home directory.</td></tr><tr><td><code>{home}/bin/*</code></td><td>Any file in the user’s <code>bin</code> (or <code>~/bin</code>).</td></tr><tr><td><code>{usr}/bin/*</code></td><td>Any file in <code>/usr/bin</code>.</td></tr><tr><td><code>{usr}/local/bin/*</code></td><td>Any file in <code>/usr/local/bin</code>.</td></tr><tr><td><code>{applications}/*.app</code></td><td>Any <code>.app</code> in <code>/Applications</code> (macOS).</td></tr><tr><td><code>{downloads}/*</code></td><td>Any file in the user’s Downloads (macOS).</td></tr><tr><td><code>{library}/*</code></td><td>Any file under <code>/Library</code> (macOS).</td></tr></tbody></table>

### 8. Job and Plugin JSON Paths (executablePath, arguments)

Variables in **executablePath** or task paths are resolved when the job or plugin runs.

<table data-header-hidden="false" data-header-sticky><thead><tr><th>Example path</th><th>Use case</th></tr></thead><tbody><tr><td><code>{jobroot}/bin/RedirectEvaluator/RedirectEvaluator</code></td><td>Redirect evaluator executable in the Jobs tree.</td></tr><tr><td><code>{approot}\Jobs\bin\MyScript.exe</code></td><td>Script under the application root.</td></tr><tr><td><code>{pluginroot}\KeeperPolicy\bin\Release\net8.0\KeeperPolicy.exe</code></td><td>Plugin exe path in plugin JSON.</td></tr><tr><td><code>{userprofile}\AppData\Local\MyApp\run.exe</code></td><td>User-specific app launched by a job (resolved for the target user when applicable).</td></tr></tbody></table>

### 9. Narrowing by Path Depth (one vs multiple `*`)

* **One `*`** = one path segment (e.g. one folder name).
* **Multiple `*`** = multiple segments (version/product/vendor structure).

<table data-header-hidden="false" data-header-sticky><thead><tr><th width="233.6666259765625">Pattern</th><th width="163">Depth</th><th>Example matches</th></tr></thead><tbody><tr><td><code>{programfiles}\*.exe</code></td><td>One segment</td><td><code>C:\Program Files\SomeApp.exe</code> (rare).</td></tr><tr><td><code>{programfiles}\*\*.exe</code></td><td>Two segments</td><td><code>C:\Program Files\Vendor\app.exe</code>.</td></tr><tr><td><code>{programfiles}\*\*\*.exe</code></td><td>Three segments</td><td><code>C:\Program Files\Vendor\Product\app.exe</code>.</td></tr><tr><td><code>{localappdata}\*\*.exe</code></td><td>Two segments</td><td><code>C:\...\Local\Vendor\app.exe</code>.</td></tr><tr><td><code>{localappdata}\*\*\*.exe</code></td><td>Three segments</td><td><code>C:\...\Local\Vendor\Version\app.exe</code>.</td></tr></tbody></table>

### 10. Real-World Policy Examples (conceptual)

* **Allow Git from GitHub Desktop (any version):**\
  Application path: `{userprofile}\AppData\Local\GitHubDesktop\*\resources\app\git\cmd\git.exe`
* **Scope a policy to “all executables in user Downloads”:**\
  ApplicationCheck: `*.exe`; Extension.Folders: `{downloads}` (or the platform equivalent).
* **Match any 32-bit app in Program Files (x86):**\
  `{programfilesx86}\*\*\*.exe` (adjust `*` count to your typical depth).
* **Match a tool in the Keeper Jobs bin:**\
  In a job task: `executablePath`: `{jobroot}\bin\MyTool\MyTool.exe`.
* **Deny executables only in a specific user folder:**\
  Use ApplicationCheck with a path like `{userprofile}\Documents\Scripts\*.exe` or combine with Extension.Folders `{userprofile}\Documents\Scripts` and ApplicationCheck `*.exe`.

### 11. What to Avoid

* **`*` in Extension.Folders:** e.g. `["{downloads}\\*"]` — use `["{downloads}"]` for “all of Downloads.”
* **Case on Linux/macOS:** Paths and extensions are case-sensitive; e.g. `*.EXE` won’t match `script.exe` on Linux.
* **Overly broad patterns:** `{programfiles}\*\*.exe` matches every `.exe` in any two-level subfolder of Program Files; use filters (users, machines, other rules) to narrow scope.
* **Mixing slashes on Windows:** Prefer backslash in Windows paths; the product typically normalizes, but consistent `\` avoids confusion.

***

### Reference

* [Reference: Variables](/keeperpam/endpoint-privilege-manager/policies/path-variables.md) — All built-in variables (Windows, Linux, macOS, app-specific), custom variables, protected paths.
* [Reference: Wildcards](/keeperpam/endpoint-privilege-manager/policies/wildcards.md) — Application wildcards, folder prefix matching, what to avoid.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.keeper.io/keeperpam/endpoint-privilege-manager/policies/policy-examples/advanced-examples/variables-and-wildcards.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
