# resolveCommand

<!-- https://uncage.vercel.app/docs/api/agent/functions/resolvecommand/ -->

```ts
function resolveCommand(
   cmd, 
   args?, 
   o?
): Promise<ResolvedCommand | null>;
```

Defined in: protocol/dist/node.d.ts:111

Finds `cmd` like `findCommand` and makes it startable without a shell. POSIX: the file found.
Windows: a `.exe`/`.com` directly; an npm `.cmd` shim becomes its Node + JS target (or its `.exe`
target); any other `.cmd`/`.bat` runs through the absolute cmd.exe (`/d /s /c`) with every argument
quoted. Null when nothing is found. Throws `UnsafeCommandError` when a `.cmd`/`.bat` cannot be
started safely (no absolute cmd.exe, or an argument with `"`, `%`, `!`, `^` or a line break).

## Parameters

| Parameter | Type |
| ------ | ------ |
| `cmd` | `string` |
| `args?` | `string`[] |
| `o?` | [`ResolveOptions`](https://uncage.vercel.app/docs/api/agent/interfaces/resolveoptions.md) |

## Returns

`Promise`\<[`ResolvedCommand`](https://uncage.vercel.app/docs/api/agent/interfaces/resolvedcommand.md) \| `null`\>
