> ## Documentation Index
> Fetch the complete documentation index at: https://rpa.bazhuayu.com/helpcenter/llms.txt
> Use this file to discover all available pages before exploring further.

# 写入文本文件

## 指令说明

**描述：** 把文本内容写入指定文本文件

## 参数说明

<Tabs>
  <Tab title="常规">
    <img src="https://mintcdn.com/bazhuayu-rpa-docs/y7Z2TvwRJJef-uiI/helpcenter/commands/os/images/writefilecontentcommand-03.png?fit=max&auto=format&n=y7Z2TvwRJJef-uiI&q=85&s=e460aae17ba4118bd1b6711db5bdddcb" alt="写入文本文件指令参数面板" width="978" height="732" data-path="helpcenter/commands/os/images/writefilecontentcommand-03.png" />

    | 参数         | 说明                                                     |
    | ---------- | ------------------------------------------------------ |
    | **文件路径**   | 输入或选择文件路径                                              |
    | **写入内容**   | 输入写入文件内容                                               |
    | **当文件存在时** | 指定当要写入的文件存在时要执行的操作                                     |
    | **文件编码**   | 选择文件编码方式，系统默认，UTF-8，ASCll，UTF-8 Bom，Unicode，GBK，GB2312 |
  </Tab>

  <Tab title="高级">
    本指令暂无高级参数。
  </Tab>
</Tabs>

## 使用示例

<img src="https://mintcdn.com/bazhuayu-rpa-docs/y7Z2TvwRJJef-uiI/helpcenter/commands/os/images/writefilecontentcommand-04.png?fit=max&auto=format&n=y7Z2TvwRJJef-uiI&q=85&s=a7592728b1be0a896f99835287bd684f" alt="写入文本文件使用示例" width="981" height="737" data-path="helpcenter/commands/os/images/writefilecontentcommand-04.png" />

<img src="https://mintcdn.com/bazhuayu-rpa-docs/y7Z2TvwRJJef-uiI/helpcenter/commands/os/images/writefilecontentcommand-01.png?fit=max&auto=format&n=y7Z2TvwRJJef-uiI&q=85&s=91fabaaef8509aa68c7d28dd0043a707" alt="写入文本文件使用示例" width="1280" height="173" data-path="helpcenter/commands/os/images/writefilecontentcommand-01.png" />

**该流程执行逻辑：**

1. 在【写入文本文件】中选择目标文本文件，填写要写入的内容并设置写入方式与文本编码。
2. 运行指令后，文本按照覆盖或追加方式写入文件。
3. 打开目标文件即可确认写入结果，后续流程也可以通过【读取文本文件内容】继续读取该内容。

### 效果展示

<img src="https://mintcdn.com/bazhuayu-rpa-docs/y7Z2TvwRJJef-uiI/helpcenter/commands/os/images/writefilecontentcommand-02.png?fit=max&auto=format&n=y7Z2TvwRJJef-uiI&q=85&s=b22c7c404d1b8ae67e0b790d5810c1d7" alt="写入文本文件效果展示" width="465" height="168" data-path="helpcenter/commands/os/images/writefilecontentcommand-02.png" />

<Info>
  使用指令过程中遇到问题？前往 [八爪鱼RPA 开发者社区问答板块](https://rpa.bazhuayu.com/community/questions) 提问，获取官方与社区帮助。
</Info>
