Skip to content

gh-76303: Improve documentation of the -x command line option - #155559

Merged
serhiy-storchaka merged 8 commits into
python:mainfrom
serhiy-storchaka:gh-76303-improve-x-option-docs
Aug 11, 2026
Merged

gh-76303: Improve documentation of the -x command line option#155559
serhiy-storchaka merged 8 commits into
python:mainfrom
serhiy-storchaka:gh-76303-improve-x-option-docs

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Aug 11, 2026

Copy link
Copy Markdown
Member

Supersedes #144857, which cannot be updated because maintainer edits are not enabled on the author's fork.

The documentation change is by @RoryGlenn. This branch merges main and removes the NEWS entry, which is not needed for a documentation change (as noted by @brianschubert).

@zooba asked why the example uses %~f0 rather than %~dpf0. %~f0 already expands to a fully qualified path including the drive letter, so the batch file works when launched from another directory or from another drive:

cwd on D:, invoked as C:probe.bat
arg0=C:probe.bat
tilde_f0=C:\Users\serhiy\probe.bat
tilde_dpf0=C:\Users\serhiy\probe.bat

RoryGlenn and others added 8 commits February 16, 2026 00:01
Expand the documentation for the -x command-line option to explain its
purpose and usage for turning Python scripts into Windows batch files,
with examples of batch file header lines.

Closes python#76303.
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
@bedevere-app bedevere-app Bot added docs Documentation in the Doc dir skip news labels Aug 11, 2026
@github-project-automation github-project-automation Bot moved this to Todo in Docs PRs Aug 11, 2026
@serhiy-storchaka serhiy-storchaka added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Aug 11, 2026
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #34015265 | 📁 Comparing d3c6b35 against main (837627d)

  🔍 Preview build  

1 file changed
± using/cmdline.html

@zooba

zooba commented Aug 11, 2026

Copy link
Copy Markdown
Member

@zooba asked why the example uses %~f0 rather than %~dpf0. %~f0 already expands to a fully qualified path including the drive letter

Ah yes, I'd confused it with %~n0 which expands to the name without an extension (most of the time I use %~dp0\<filename> to reference something in the same directory as the batch file, rather than the batch file itself, so I don't see %~f often).

@serhiy-storchaka
serhiy-storchaka merged commit 4b04d5a into python:main Aug 11, 2026
46 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖

@serhiy-storchaka
serhiy-storchaka deleted the gh-76303-improve-x-option-docs branch August 11, 2026 14:45
@github-project-automation github-project-automation Bot moved this from Todo to Done in Docs PRs Aug 11, 2026
@bedevere-app

bedevere-app Bot commented Aug 11, 2026

Copy link
Copy Markdown

GH-155565 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Aug 11, 2026
@bedevere-app

bedevere-app Bot commented Aug 11, 2026

Copy link
Copy Markdown

GH-155566 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Aug 11, 2026
@bedevere-app

bedevere-app Bot commented Aug 11, 2026

Copy link
Copy Markdown

GH-155567 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Aug 11, 2026
serhiy-storchaka added a commit that referenced this pull request Aug 11, 2026
…H-155559) (GH-155567)

Expand the documentation for the -x command-line option to explain its
purpose and usage for turning Python scripts into Windows batch files,
with examples of batch file header lines.
(cherry picked from commit 4b04d5a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Rory Glenn <glennrory@gmail.com>
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
serhiy-storchaka added a commit that referenced this pull request Aug 11, 2026
…H-155559) (GH-155566)

Expand the documentation for the -x command-line option to explain its
purpose and usage for turning Python scripts into Windows batch files,
with examples of batch file header lines.
(cherry picked from commit 4b04d5a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Rory Glenn <glennrory@gmail.com>
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants