> 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/cao-zuo-zhi-nan/file-and-folder/read-all-text.md).

# 文件读取所有文本

文件读取所有文本是指一次性读取一个`.txt`格式文本文件的全部内容。文件中的所有数据将以单个字符串的形式返回，并存储在一个输出变量中（Output variable）。

#### 配置参数：

* 文件路径：指向需要读取的`.txt`文件的绝对路径（例如：`D:\data\content.txt`）。
* 输出变量：存储刚读取的字符结构的变量名称。

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

假设您准备了一篇较长的文章（包含多句、换行符、空格）存储在文本文件`D:\GPM\post.txt`中。您希望获取全部内容以自动填充到浏览器的发布框中：

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


---

# 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/cao-zuo-zhi-nan/file-and-folder/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.
