René's URL Explorer Experiment


Title: Unquoted strings · Issue #146 · PoshCode/PowerShellPracticeAndStyle · GitHub

Open Graph Title: Unquoted strings · Issue #146 · PoshCode/PowerShellPracticeAndStyle

X Title: Unquoted strings · Issue #146 · PoshCode/PowerShellPracticeAndStyle

Description: PowerShell allows for unquoted strings as shown in the Style-Guide/Naming-Conventions: # Instead write: Get-Content -Path (Join-Path -Path $PSScriptRoot -ChildPath README.md) But there are limitations to using unquoted strings as e.g. sp...

Open Graph Description: PowerShell allows for unquoted strings as shown in the Style-Guide/Naming-Conventions: # Instead write: Get-Content -Path (Join-Path -Path $PSScriptRoot -ChildPath README.md) But there are limitati...

X Description: PowerShell allows for unquoted strings as shown in the Style-Guide/Naming-Conventions: # Instead write: Get-Content -Path (Join-Path -Path $PSScriptRoot -ChildPath README.md) But there are limitati...

Opengraph URL: https://github.com/PoshCode/PowerShellPracticeAndStyle/issues/146

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Unquoted strings","articleBody":"PowerShell allows for unquoted strings as shown in the [Style-Guide/Naming-Conventions](https://poshcode.gitbooks.io/powershell-practice-and-style/Style-Guide/Naming-Conventions.html):\r\n```PowerShell\r\n# Instead write:\r\nGet-Content -Path (Join-Path -Path $PSScriptRoot -ChildPath README.md)\r\n```\r\n\r\nBut there are limitations to using unquoted strings as e.g. spaces are not allowed in an unquoted value and will obviously fail if not quoted (with either single or double quotes, see the related issue: #63):\r\n```PowerShell\r\n# Wrong:\r\nGet-Content -Path (Join-Path -Path $PSScriptRoot -ChildPath READ ME.md)\r\n```\r\n\r\nBesides using unquoted strings in argument values, unquoted strings are common (best practice?) in hash tables keys. Hash tables  are major objects in PowerShell along with PSCustomObjects which are in fact constructed from a hash table. Hash tables are also used for things like splatting and PowerShell Data files.\r\n\r\nAs with argument values, the use of unquoted hash table keys is limited to certain characters, as e.g.:\r\n```PowerShell\r\n# Wrong:\r\n$Options = @{\r\n    Margin    = 2\r\n    Padding   = 2\r\n    Font-Size = 24\r\n}\r\n```\r\nWill cause an error:\r\n```\r\nLine |\r\n   4 |      Font-Size = 24\r\n     |          ~\r\n     | Missing '=' operator after key in hash literal.\r\n```\r\n\r\nIn some cases there are no errors but pitfalls, like:\r\n```PowerShell\r\n$Hashtable = @{ \r\n    U2 = 'String'\r\n    2U = 'UInt32'\r\n}\r\n```\r\n```PowerShell\r\n$Hashtable.keys\r\n2\r\nU2\r\n```\r\n\r\nAFAIK, there is no clear definition of when I should use quoted keys (or argument values) or when I might not. In other words: which characters are allowed for unquoted strings (or: which characters are not allowed for unquoted strings)?\r\nIt is also not described in [About Quoting Rules](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_quoting_rules?view=powershell-7) or in [About Special Characters](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_special_characters?view=powershell-7)\r\n\u003csub\u003e(Assuming I am right, should I created a separate documentation issue at the [PowerShell Team](https://github.com/PowerShell/PowerShell/issues)?)\u003c/sub\u003e\r\n\r\nSo usually I use quotes on a trial-on-error bases or pro-actively on a better-safe-than-sorry bases. But that could cause some inconsistency in defining the best (readable) practice to resolve the above error:\r\n\r\n ```PowerShell\r\n$Options = @{\r\n    Margin      = 2\r\n    Padding     = 2\r\n    'Font-Size' = 24\r\n}\r\n```\r\nOr:\r\n ```PowerShell\r\n$Options = @{\r\n    'Margin'    = 2\r\n    'Padding'   = 2\r\n    'Font-Size' = 24\r\n}\r\n```\r\nI am especially concerned with this writing style / best practice issue because I am maintaining a [ConvertTo-Expression](https://github.com/iRon7/ConvertTo-Expression) script. Although the code might not follow the styling guidelines (yet), I am committed to follow them for the expression it outputs as much as possible.\r\nFor this project, I got the issue request: [Remove quotes in HashTables Keys when possible](https://github.com/iRon7/ConvertTo-Expression/issues/3) and looking for some documented guidance.","author":{"url":"https://github.com/iRon7","@type":"Person","name":"iRon7"},"datePublished":"2020-06-19T18:32:50.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/146/PowerShellPracticeAndStyle/issues/146"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:b86ab800-afff-7fa5-199e-7f078c87df22
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9EE4:2CD505:2CD4ABC:3E20C3C:6977B4C7
html-safe-nonce5239b04903cbc615f4ffdf33a0e1c36c447f1b5de48f8c852b1547ce4e83f309
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RUU0OjJDRDUwNToyQ0Q0QUJDOjNFMjBDM0M6Njk3N0I0QzciLCJ2aXNpdG9yX2lkIjoiNjE1MzY1NTc0NzA1ODU3ODYzMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac3ec21966980a9e22fd5d7df8c3d39446051a12afc47558bec176c60f6a1699fe
hovercard-subject-tagissue:642154328
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PoshCode/PowerShellPracticeAndStyle/146/issue_layout
twitter:imagehttps://opengraph.githubassets.com/2a68c42c0e13507e1a023759ec7a2f188470c487753f3b81943f0d0d96f0d68f/PoshCode/PowerShellPracticeAndStyle/issues/146
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/2a68c42c0e13507e1a023759ec7a2f188470c487753f3b81943f0d0d96f0d68f/PoshCode/PowerShellPracticeAndStyle/issues/146
og:image:altPowerShell allows for unquoted strings as shown in the Style-Guide/Naming-Conventions: # Instead write: Get-Content -Path (Join-Path -Path $PSScriptRoot -ChildPath README.md) But there are limitati...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameiRon7
hostnamegithub.com
expected-hostnamegithub.com
None831218810e1b66a41a0626c8c15f7f47625846d9a7516c7f43cfc2c61effad83
turbo-cache-controlno-preview
go-importgithub.com/PoshCode/PowerShellPracticeAndStyle git https://github.com/PoshCode/PowerShellPracticeAndStyle.git
octolytics-dimension-user_id5641451
octolytics-dimension-user_loginPoshCode
octolytics-dimension-repository_id17317123
octolytics-dimension-repository_nwoPoshCode/PowerShellPracticeAndStyle
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id17317123
octolytics-dimension-repository_network_root_nwoPoshCode/PowerShellPracticeAndStyle
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseb37ffa89d073c0d4a6f07ff42d59120741a74955
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/PoshCode/PowerShellPracticeAndStyle/issues/146#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2FPoshCode%2FPowerShellPracticeAndStyle%2Fissues%2F146
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2FPoshCode%2FPowerShellPracticeAndStyle%2Fissues%2F146
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=PoshCode%2FPowerShellPracticeAndStyle
Reloadhttps://patch-diff.githubusercontent.com/PoshCode/PowerShellPracticeAndStyle/issues/146
Reloadhttps://patch-diff.githubusercontent.com/PoshCode/PowerShellPracticeAndStyle/issues/146
Reloadhttps://patch-diff.githubusercontent.com/PoshCode/PowerShellPracticeAndStyle/issues/146
PoshCode https://patch-diff.githubusercontent.com/PoshCode
PowerShellPracticeAndStylehttps://patch-diff.githubusercontent.com/PoshCode/PowerShellPracticeAndStyle
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2FPoshCode%2FPowerShellPracticeAndStyle
Fork 294 https://patch-diff.githubusercontent.com/login?return_to=%2FPoshCode%2FPowerShellPracticeAndStyle
Star 2.4k https://patch-diff.githubusercontent.com/login?return_to=%2FPoshCode%2FPowerShellPracticeAndStyle
Code https://patch-diff.githubusercontent.com/PoshCode/PowerShellPracticeAndStyle
Issues 37 https://patch-diff.githubusercontent.com/PoshCode/PowerShellPracticeAndStyle/issues
Pull requests 1 https://patch-diff.githubusercontent.com/PoshCode/PowerShellPracticeAndStyle/pulls
Discussions https://patch-diff.githubusercontent.com/PoshCode/PowerShellPracticeAndStyle/discussions
Actions https://patch-diff.githubusercontent.com/PoshCode/PowerShellPracticeAndStyle/actions
Projects 0 https://patch-diff.githubusercontent.com/PoshCode/PowerShellPracticeAndStyle/projects
Wiki https://patch-diff.githubusercontent.com/PoshCode/PowerShellPracticeAndStyle/wiki
Security 0 https://patch-diff.githubusercontent.com/PoshCode/PowerShellPracticeAndStyle/security
Insights https://patch-diff.githubusercontent.com/PoshCode/PowerShellPracticeAndStyle/pulse
Code https://patch-diff.githubusercontent.com/PoshCode/PowerShellPracticeAndStyle
Issues https://patch-diff.githubusercontent.com/PoshCode/PowerShellPracticeAndStyle/issues
Pull requests https://patch-diff.githubusercontent.com/PoshCode/PowerShellPracticeAndStyle/pulls
Discussions https://patch-diff.githubusercontent.com/PoshCode/PowerShellPracticeAndStyle/discussions
Actions https://patch-diff.githubusercontent.com/PoshCode/PowerShellPracticeAndStyle/actions
Projects https://patch-diff.githubusercontent.com/PoshCode/PowerShellPracticeAndStyle/projects
Wiki https://patch-diff.githubusercontent.com/PoshCode/PowerShellPracticeAndStyle/wiki
Security https://patch-diff.githubusercontent.com/PoshCode/PowerShellPracticeAndStyle/security
Insights https://patch-diff.githubusercontent.com/PoshCode/PowerShellPracticeAndStyle/pulse
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/PoshCode/PowerShellPracticeAndStyle/issues/146
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/PoshCode/PowerShellPracticeAndStyle/issues/146
Unquoted stringshttps://patch-diff.githubusercontent.com/PoshCode/PowerShellPracticeAndStyle/issues/146#top
https://github.com/iRon7
https://github.com/iRon7
iRon7https://github.com/iRon7
on Jun 19, 2020https://github.com/PoshCode/PowerShellPracticeAndStyle/issues/146#issue-642154328
Style-Guide/Naming-Conventionshttps://poshcode.gitbooks.io/powershell-practice-and-style/Style-Guide/Naming-Conventions.html
#63https://github.com/PoshCode/PowerShellPracticeAndStyle/issues/63
About Quoting Ruleshttps://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_quoting_rules?view=powershell-7
About Special Charactershttps://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_special_characters?view=powershell-7
PowerShell Teamhttps://github.com/PowerShell/PowerShell/issues
ConvertTo-Expressionhttps://github.com/iRon7/ConvertTo-Expression
Remove quotes in HashTables Keys when possiblehttps://github.com/iRon7/ConvertTo-Expression/issues/3
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.