| 用途 | 在无编辑器的环境创建小文本文件 |
|---|---|
| 语法 | copy con 文件名 → 输入内容 → Ctrl+Z 后回车 |
| 替代 | 单行内容用 echo 内容> 文件;追加用重定向 >> |
常用示例
常用示例
copy con hello.txt
hello windows
this is line 2
^Z
REM ^Z 表示 Ctrl+Z:先回车换行,再按 Ctrl+Z 并回车
REM 单行写入更常用:
echo hello windows> hello.txt
echo another line>> hello.txtCtrl+Z 必须在行首按下(先换行再按),否则最后一行可能丢失;中文内容注意代码页,必要时先 chcp 65001。