# %shellcapture() function

The %shellcapture() function executes
the MS-DOS command, command, and captures the result in the *buffer* variable, up to the maximum size. If the buffer
is not large enough, the exceeding output is discarded.

## Syntax

```
code = %shellcapture(command, buffer, size, read)
```

## Description

This form should be used when
the expected output is small. The size of the buffer is returned in *read*. If there is not enough space in the provided buffer, *read* is set to the maximum value size.

This function
returns 0 if successful.

## Example(s)

The %shellcapture() function executes an executable file, not the command built-ins.
For example, to list a directory (DIR), type the following, or something
similar:

```
%shellcapture("cmd /c dir", buffer, buffsize, &readsize)
```

---
Source: https://d3codex.com/pickbasic-flashbasic/percent-shellcapture-function/ - part of the D3Codex reference.
