question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Summary of the new feature/enhancement

I want non-double quoted symbols not to behave like double quotes.

If that’s difficult, consider adding it to your pwsh.exe startup options.

Example problem

Command

Test-Path "“OK!“"

Result

Test-Path: A positional parameter cannot be found that accepts argument 'OK!'.

pwsh_eJiKoeyoZc

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
mklement0commented, Feb 28, 2021

I forgot the more obvious solutions:

Single-quoting:

PS> '“OK!“'
“OK!“

`-escaping:

PS> "`“OK!`“"
“OK!“
2reactions
mklement0commented, Mar 1, 2021

I understand that PowerShell’s permissiveness with respect to quoting/whitespace equivalence can be surprising.

I can’t speak to the original design intent, but I assume it was to accommodate source code created with or copied and pasted from editors that use non-ASCII-range quotation marks and whitespace.

If you have verbatim file names that are passed via macro expansion, before PowerShell sees the resulting source code, use a verbatim here-string (this also works with file names that contain '):

# Assume the content of the here-string is provided via up-front macro expansion:
Write-Output @'
“OK!“
'@

Note that if your file name is stored in a PowerShell variable, no extra effort is needed:

$fname = '“OK!“'
Write-Output $fname
Read more comments on GitHub >

github_iconTop Results From Across the Web

What Is a Feature Request? Definition and Examples
A feature request is a comment, message, or ask from a user to implement a specific feature into your product. Feature requests can...
Read more >
Feature Request Management Software
Canny's feature request management tools let you collect, organize, and analyze feedback with ease. Create your feature request board today! Start for free!...
Read more >
7 Useful Tips to Manage Feature Requests
1. Create a central place to gather and review all feature requests. · 2. Respond to every request — personally, honestly, and promptly....
Read more >
Feature Request Template: How to Collect User Feedback ...
A feature request template is a standardized form that allows users and customers to submit feature requests for your product. These can be ......
Read more >
How to Manage Product Feature Requests – 6 Best Practices
A feature request is an idea a customer sends your way to make you understand how he's using your product, and what he...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found