用 `shortcuts run` 在命令行运行快捷指令
在终端中直接运行“快捷指令”App 里保存的自动化,无需打开窗口。
在终端执行 `shortcuts run "快捷指令名称"` 即可立即运行该快捷指令。
01命令
命令
$ shortcuts run "转换 PNG 为 JPG"02作用说明
macOS 自带 `shortcuts` 命令行工具,是“快捷指令”App 的命令行版本。它可以运行你快捷指令库里的任意一条指令,还能通过参数或标准输入接收数据,因此可以把快捷指令嵌入 shell 脚本、launchd 定时任务或 SSH 会话中使用。
03风险
!注意: 快捷指令会以你的完整用户权限运行,切勿运行来源不明的快捷指令;名称含空格时必须加引号,并与快捷指令 App 中显示的名称完全一致。
04撤销
✓无需撤销——该命令不会改变持久状态。
05来源
- shortcuts – Run or list shortcuts on macOS依据: Documents shortcuts run/list/view, available from macOS 12 Monterey
- Shortcuts User Guide for Mac依据: Apple documents creating shortcuts that can then be run from the menu bar or command line
最后验证: 2026-09-18 · 分类: 系统与设置