Answer: Use the -p flag to pass Copilot CLI a prompt without initiating an interactive session, for example: copilot -p "Summarize what this file does: ./README.md". Any prompt you would type in an interactive session works with -p. Status: Confirmed Entry: tool/github-copilot/commands-and-shortcuts/run-prompt-from-command-line Revision: 2 Digest: sha256:c0d3ea2d94b3fc69 (changes whenever the content changes) Timeline: Created: 2026-11-13T03:23:45Z Last changed: 2026-11-17T13:17:52Z (prompt compatibility: Any prompt you would type in an interactive session works with -p . → Any prompt you would type in an interactive session works with -p) Last verified: 2026-11-20T13:01:52Z Next check: 2026-11-21T13:01:52Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of flag | -p | [1] | 2026-11-20 example command | copilot -p "Summarize what this file does: ./README.md" | [1] | 2026-11-20 prompt compatibility | Any prompt you would type in an interactive session works with -p | [1] | 2026-11-20 Sources: [1] GitHub. "Quickstart for automating with GitHub Copilot CLI - GitHub Docs". https://docs.github.com/en/copilot/how-tos/copilot-cli/automate-copilot-cli/quickstart Role: primary. Accessed: 2026-11-20T13:01:52Z Quote: "use the -p flag" (Supports: flag) Quote: "copilot -p "Summarize what this file does: ./README.md"" (Supports: example command) Quote: "Any prompt you would type in an interactive session works with -p" (Supports: prompt compatibility) Snapshot SHA-256: e3a66da660ecfbdc5a7f5521203344007dabdc6f175bab70faee79592d2351e8 (captured 2026-11-18T12:56:02Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. On this check the text of [1] was unchanged since 2026-11-18T12:56:02Z, so the values verified then were kept. Cross-check: not-available at 2026-11-20T13:01:52Z. No independent second source is configured for this entry Last successful check: 2026-11-20T13:01:52Z Last attempt: 2026-11-20T13:01:52Z Notes and limitations: Extracted automatically from a single official source (section "Run a prompt from the command line"). Related: https://latestn.com/tool/github-copilot/commands-and-shortcuts/run-research-investigation How do I run a research investigation with GitHub Copilot CLI? https://latestn.com/tool/github-copilot/commands-and-shortcuts/run-tests-slash-command How do I run the test cases GitHub Copilot generated using a slash command? https://latestn.com/tool/github-copilot/commands-and-shortcuts/schedule-once-prompt-after How do I schedule a one-time prompt in GitHub Copilot CLI with /after? https://latestn.com/tool/github-copilot/commands-and-shortcuts/resume-previous-session How do I resume a previous GitHub Copilot CLI session? https://latestn.com/tool/github-copilot/commands-and-shortcuts/rollback-double-esc How do I roll back changes in GitHub Copilot CLI using a double Esc keypress? https://latestn.com/tool/github-copilot/commands-and-shortcuts/run-command-outside-sandbox How do I run a single command outside the GitHub Copilot sandbox? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-17T13:17:52Z | changed | prompt compatibility: Any prompt you would type in an interactive session works with -p . → Any prompt you would type in an interactive session works with -p | [1] 2026-11-13T03:23:45Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/github-copilot/commands-and-shortcuts/run-prompt-from-command-line/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/github-copilot/commands-and-shortcuts/run-prompt-from-command-line POST: https://latestn.com/dispute/tool/github-copilot/commands-and-shortcuts/run-prompt-from-command-line with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/github-copilot/commands-and-shortcuts/run-prompt-from-command-line?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I run a prompt with GitHub Copilot CLI from the command line? Revision 2, last verified 2026-11-20T13:01:52Z. https://latestn.com/tool/github-copilot/commands-and-shortcuts/run-prompt-from-command-line (accessed 2026-11-21T10:02:40Z). @misc{LatestN_tool_github_copilot_commands_and_shortcuts_run_prompt_from_command_line_r2, title = {How do I run a prompt with GitHub Copilot CLI from the command line?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/github-copilot/commands-and-shortcuts/run-prompt-from-command-line}}, note = {Revision 2; digest sha256:c0d3ea2d94b3fc69; last verified 2026-11-20T13:01:52Z; accessed 2026-11-21T10:02:40Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/github-copilot/commands-and-shortcuts/run-prompt-from-command-line