Categories
Tags
Astro Automation Camping changelog clear CLI Codex compact Component Design Configuration context Context Copilot copy Ctrl+S CUDA Cursor Day Trip delegate diff Dynamic Routing Editor Error Error Fix Error Handling experimental Gemini git GitHub GitHub Copilot Google Hiking Hot Springs init Installation Iwate Prefecture Kobe Linux Mac Mention Meteor Shower Mode Switching model Nara Prefecture NoAdapterInstalled Node.js nvm OpenAI params plan PowerShell Prompt props Public Key Authentication Python Redirect research rewind SEO share Shell Execution Shift+Tab Shortcut SSH SSH config ssh-copy-id Stargazing Static Site streamer-mode Student undo Update usage Visual Studio VS Code VS2026 Windows WSL
127 words
1 minutes
How to Run GitHub Copilot CLI with a Direct Prompt【-p Flag】
Overview
Opening Copilot CLI, waiting for the interactive prompt, typing your question, getting the answer, then exiting — feels like a lot of steps for a quick one-off task, doesn’t it?
The -p flag lets you pass a prompt directly from your terminal for one-shot execution.
Usage
Run from your terminal:
copilot -p "translate this README.md to Japanese"The prompt is processed without entering interactive mode. --prompt works too:
copilot --prompt "find and fix the failing tests"When to Use It
| Scenario | Example |
|---|---|
| Quick one-off question | copilot -p "explain this function" |
| Script automation | Embed in CI/CD or shell scripts |
| Shell aliases | Register frequently used prompts as aliases |
Interactive vs. -p
| Method | Best for |
|---|---|
copilot (interactive) | Multi-turn conversations |
copilot -p "..." | Single-shot tasks |
For quick questions or one-time file edits, -p keeps things snappy.
Related Posts
How to Run GitHub Copilot CLI with a Direct Prompt【-p Flag】
https://naonao-na.com/en/posts/github-copilot-cli-prompt-flag/
