gh-76303: Improve -x option documentation - #144857
Closed
RoryGlenn wants to merge 6 commits into
Closed
Conversation
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>
serhiy-storchaka
approved these changes
Feb 25, 2026
serhiy-storchaka
left a comment
Member
There was a problem hiding this comment.
LGTM, but it needs a review from Windows experts. Right now it is difficult to me to test this on Windows.
Member
|
@zooba, could you please take a look? |
zooba
reviewed
May 6, 2026
|
|
||
| .. code-block:: batch | ||
|
|
||
| @py -x "%~f0" %* & exit /b |
Member
There was a problem hiding this comment.
I normally use %~dpf0 to ensure the full path is used, which handles launching the batch file from a different directory. Any particular reason not to do that here?
|
This PR is stale because it has been open for 90 days with no activity. |
Member
|
Superseded by #155559, which merges main and removes the NEWS entry. Thank you @RoryGlenn for the contribution, your commit is preserved there. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Expand the documentation for the
-xcommand-line option to explain its purpose and usage for turning Python scripts into Windows batch files, with examples of batch file header lines.The current documentation is a single line:
This gives virtually no information about why the option exists or how to use it. As noted by @serhiy-storchaka in the issue, the purpose of
-xis to allow turning Python scripts into Windows batch files (similar to how shebang lines work on Unix).The expanded documentation now includes:
-xis needed (the header line is not valid Python syntax)📚 Documentation preview 📚: https://cpython-previews--144857.org.readthedocs.build/