# executeCommandAsync

- Module: [Aspire.Hosting](/reference/api/typescript/aspire.hosting.md)
- Version: `13.4.0`
- Kind: `method`
- Source: [GitHub](https://github.com/microsoft/aspire)

Executes a command for the specified resource.

## Definition

```typescript
interface ResourceCommandService {
  // ... omitted for brevity
  executeCommandAsync(
    resource: IResource,
    commandName: string,
    arguments?: Dict<string,string>,
    cancellationToken?: cancellationToken): ExecuteCommandResult
}
```

## Parameters

- `resource` ([IResource](/reference/api/typescript/aspire.hosting/iresource.md))
- `commandName` (`string`)
- `arguments` (`Dict<string,string>`) `optional`
- `cancellationToken` (`cancellationToken`) `optional`

## Returns

[ExecuteCommandResult](/reference/api/typescript/aspire.hosting/executecommandresult.md)

## Applies to

- [ResourceCommandService](/reference/api/typescript/aspire.hosting/resourcecommandservice.md)
