Skip to content
FunCoding

Search

Search docs, Skills and MCP

CLI 启动参数

选择单次或交互 prompt,配置流协议、审批、扩展与诊断参数。

This page has not been translated into English yet. The original Chinese version is shown below.

以下按官方配置页列出的启动参数整理,额外预算与认证参数分别见相应章节。运行本机 qwen --help 可核对所安装版本支持的参数。

输入与系统指令

qwen -p "Explain this project." --output-format json
qwen -i "Help me understand the current module."

-p/--prompt 为非交互任务;-i/--prompt-interactive 把初始消息放入交互会话,不能与管道 stdin 同用。-m/--model 选择本次模型。

--system-prompt 替换主会话内置 system prompt,但加载的 QWEN.md 等仍追加。--append-system-prompt 在内置/替换提示和上下文之后追加,可与前者合用。

--output-style 选择 Concise、Proactive、Explanatory、Learning、自定义样式名或 default,覆盖 general.outputStyle;未知名警告后使用默认。--system-prompt 或 QWEN_SYSTEM_MD 替换内置提示时样式不生效。

输出协议

参数含义
-o / --output-formattext(默认)、json(结束时输出)、stream-json(流式消息)
--input-formattext(默认)或 stream-json;后者保留 stdin 给双向协议
--include-partial-messages输出流式 message/content delta 等,默认 false

后两个流式选项要求显式 --output-format stream-json;仅在 settings 写输出格式不满足 argv 校验。完整脚本流程见无头模式。

审批与沙箱

--approval-mode 支持 plan、default、auto-edit、auto、yolo;不能与 --yolo 同时使用。--yolo 相当于选择 yolo,不隐含沙箱。

--allowed-tools 接受逗号分隔的规则,例如 --allowed-tools "Shell(git status)",只跳过匹配调用的确认,不是禁用其他工具的白名单。

--disabled-slash-commands 接受逗号分隔或重复名称,与配置和环境禁用项取并集。

-s/--sandbox 接受可选后端值;有 prompt 时用 --sandbox=true 或搭配 -p 避免将 prompt 当成后端。--sandbox-image 指定镜像;后者优先环境和配置,沙箱启用本身却由 QWEN_SANDBOX 环境优先,见容器沙箱。

集成与范围

--acp 是稳定 Agent Client Protocol 入口,替代旧 --experimental-acp。--experimental-lsp 开启实验性语言服务,需要已安装对应 server,配置在项目 .lsp.json。

-e/--extensions 可重复指定启用扩展;未提供时使用可用扩展,qwen -e none 禁用全部。-l/--list-extensions 列出后退出。

--include-directories 可重复或逗号分隔添加目录;--proxy 设置代理;--screen-reader 开启屏幕阅读器适配。额外目录不扩大 Linux executionSandbox 写权限。

诊断与记录

-d/--debug 开启诊断,-h/--help 帮助,--version 显示版本。--openai-logging 记录 API 请求响应,--openai-logging-dir 指定日志目录。

--telemetry、--telemetry-target、--telemetry-otlp-endpoint、--telemetry-otlp-protocol、--telemetry-log-prompts 控制遥测;协议为 grpc/http,CLI 表列默认 grpc。target 只是标签,不决定导出目的地;详见日志与追踪。

--max-wall-time、--max-tool-calls、--max-subagent-depth 的单位、上限和退出条件见预算限制。