> ## Documentation Index
> Fetch the complete documentation index at: https://docs.base44.com/llms.txt
> Use this file to discover all available pages before exploring further.

# exec

> Run a script with the Base44 SDK pre-authenticated

Run a TypeScript or JavaScript script with the Base44 SDK pre-authenticated as the current user. The SDK is available as a global `base44` variable. Scripts are executed locally using Deno.

For a full walkthrough, use cases, and prerequisites, see the [Standalone scripts](/developers/backend/overview/run-scripts) guide.

## Usage

Pipe a script file to exec:

```bash theme={null}
cat ./script.ts | base44 exec
```

Or pass inline code:

```bash theme={null}
echo "console.log(await base44.entities.Tasks.list())" | base44 exec
```

By default `exec` targets the app linked in the current project's `.app.jsonc`. To run a script against any other app on your account, pass `--app-id` or set the `BASE44_APP_ID` environment variable. This works from anywhere on your machine, including against apps you built in the Base44 online app editor and never linked locally.

```bash theme={null}
echo "console.log(await base44.entities.Tasks.list())" | base44 exec --app-id <your-app-id>
```

## Flags

| Flag            | Description                                                                                                                                                                   |
| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--app-id <id>` | Target the specified app. Defaults to the app linked in the current project. See [Select a target app](/developers/references/cli/commands/introduction#select-a-target-app). |

## See also

* [Standalone scripts](/developers/backend/overview/run-scripts): Full guide with use cases and prerequisites
