Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows command line does not support single quotes. #91856

Closed
wants to merge 2 commits into from

Conversation

BruceLee569
Copy link
Contributor

@BruceLee569 BruceLee569 commented Apr 23, 2022

System version: Windows 10 21H2

Python version: Python 3.9.5 (tags/v3.9.5:0a7dcbd, May 3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] on win32

At the command-line terminal (cmd or Powershell) you have to use double quotes to enclose the argument you wish to send. Enclose it with double quotes, and use single quotes within it. (https://stackoverflow.com/a/34379661/11687405)

For details, please refer to the GIF:https://gifyu.com/image/SLtLK

System version: Windows 10 21H2

Python version: Python 3.9.5 (tags/v3.9.5:0a7dcbd, May  3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] on win32

At the command-line terminal (cmd or Powershell) you have to use double quotes to enclose the argument you wish to send. Enclose it with double quotes, and use single quotes within it. (https://stackoverflow.com/a/34379661/11687405)

For details, please refer to the GIF:![demo](https://gifyu.com/image/SLtLK)
@cpython-cla-bot
Copy link

cpython-cla-bot bot commented Apr 23, 2022

The following commit authors need to sign the Contributor License Agreement:

Click the button to sign:
CLA not signed

@bedevere-bot bedevere-bot added docs Documentation in the Doc dir awaiting review labels Apr 23, 2022
@fatihkabakk
Copy link
Contributor

System version: Windows 10 21H2

Python version: Python 3.9.5 (tags/v3.9.5:0a7dcbd, May 3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] on win32

At the command-line terminal (cmd or Powershell) you have to use double quotes to enclose the argument you wish to send. Enclose it with double quotes, and use single quotes within it. (https://stackoverflow.com/a/34379661/11687405)

For details, please refer to the GIF:https://gifyu.com/image/SLtLK

Yes, you're correct. However, powershell does not require double quotes. Powershell is like a simulation of cmd and sh together. To explain in detail, cmd requires every space-including parameter to be encolsed in double quotes. Also, see The Developer Guide.

@JelleZijlstra
Copy link
Member

On Unix, single quotes are better because double quotes may do variable substitution. I'm not familiar enough with Windows to opine on what quotes are better there.

@zooba
Copy link
Member

zooba commented May 2, 2022

Maybe just say "single or double quotes"? This is a hint for people who are both new to terminals and new to Python, but it isn't really our responsibility to go too deep into how to use every single terminal in the world.

In general, Windows and cmd don't care about quotes, but the apps themselves do the splitting and might care. PowerShell expands variables within double quotes, but not within single quotes, but it's hard to say which may be preferred in any given case.

So basically, "it's complicated," and we should probably just avoid having too strong an opinion.

@JelleZijlstra JelleZijlstra self-assigned this Oct 5, 2022
JelleZijlstra added a commit to JelleZijlstra/cpython that referenced this pull request Oct 12, 2022
Closes python#91856.

On Windows double quotes are sometimes better, on Unix usually
single quotes. It's not our place to explain that, so just don't.
@JelleZijlstra
Copy link
Member

Opened #98204 because of the CLA issues on this one. (The change we ended up with is distinct enough from @BruceLee569's original change that I don't think there's an issue with the new PR.)

JelleZijlstra added a commit that referenced this pull request Oct 12, 2022
Closes #91856.

On Windows double quotes are sometimes better, on Unix usually
single quotes. It's not our place to explain that, so just don't.
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 12, 2022
Closes pythonGH-91856.

On Windows double quotes are sometimes better, on Unix usually
single quotes. It's not our place to explain that, so just don't.
(cherry picked from commit 5f8ca1b)

Co-authored-by: Jelle Zijlstra <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 12, 2022
Closes pythonGH-91856.

On Windows double quotes are sometimes better, on Unix usually
single quotes. It's not our place to explain that, so just don't.
(cherry picked from commit 5f8ca1b)

Co-authored-by: Jelle Zijlstra <[email protected]>
miss-islington added a commit that referenced this pull request Oct 12, 2022
Closes GH-91856.

On Windows double quotes are sometimes better, on Unix usually
single quotes. It's not our place to explain that, so just don't.
(cherry picked from commit 5f8ca1b)

Co-authored-by: Jelle Zijlstra <[email protected]>
miss-islington added a commit that referenced this pull request Oct 12, 2022
Closes GH-91856.

On Windows double quotes are sometimes better, on Unix usually
single quotes. It's not our place to explain that, so just don't.
(cherry picked from commit 5f8ca1b)

Co-authored-by: Jelle Zijlstra <[email protected]>
pablogsal pushed a commit that referenced this pull request Oct 22, 2022
Closes GH-91856.

On Windows double quotes are sometimes better, on Unix usually
single quotes. It's not our place to explain that, so just don't.
(cherry picked from commit 5f8ca1b)

Co-authored-by: Jelle Zijlstra <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants