> For the complete documentation index, see [llms.txt](https://docs.gpmautomate.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gpmautomate.com/automate-zh/action-shi-yong-zhi-nan/file-and-folder/file-read-all-text.md).

# File read all text

File read all text 是用于一次性完整读取 `.txt` 格式文本文件内容的动作。文件内部的所有数据将以单一字符串（string）形式返回，并保存到输出变量（Output variable）中。

🎥 观看更多教程视频：[点击此处](https://youtu.be/EH7olDLAb9c)。

#### 配置参数：

* File Path：需要读取的 `.txt` 文件的绝对路径（例如：`D:\data\content.txt`）。
* Output variable：用于保存刚读取到的字符串结构的变量名称。

#### 实际示例：读取预先准备好的文章内容

假设你准备了一篇较长的文章（包含多个句子、换行符、空格）保存在文本文件 `D:\GPM\post.txt` 中。你想获取这篇文章的全部内容，以自动填入浏览器上的发帖输入框中：

* 配置方式：
  * File Path：填写路径 `D:\GPM\post.txt`
  * Output variable：将保存结果的变量命名为 `$textContent`。
* 结果：系统将完整提取文件中的所有字符和行结构，并赋值给变量 `$textContent`。在接下来的步骤中，你只需调用 Key press 动作，将该 `$textContent` 变量传入网站的输入框即可完成操作。

<figure><img src="/files/3cDVXvGzRmp0pboMyYis" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.gpmautomate.com/automate-zh/action-shi-yong-zhi-nan/file-and-folder/file-read-all-text.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
