René's URL Explorer Experiment


Title: Call native operator · Issue #13068 · PowerShell/PowerShell · GitHub

Open Graph Title: Call native operator · Issue #13068 · PowerShell/PowerShell

X Title: Call native operator · Issue #13068 · PowerShell/PowerShell

Description: Problem Statement Currently, there are cases where cutting and pasting a native command line fails to run as expected in PowerShell. This may be due to incorrect parsing of quotes meant to be passed to the native command or use of PowerS...

Open Graph Description: Problem Statement Currently, there are cases where cutting and pasting a native command line fails to run as expected in PowerShell. This may be due to incorrect parsing of quotes meant to be passe...

X Description: Problem Statement Currently, there are cases where cutting and pasting a native command line fails to run as expected in PowerShell. This may be due to incorrect parsing of quotes meant to be passe...

Opengraph URL: https://github.com/PowerShell/PowerShell/issues/13068

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Call native operator","articleBody":"## Problem Statement\r\n\r\nCurrently, there are cases where cutting and pasting a native command line fails to run as expected in PowerShell.  This may be due to incorrect parsing of quotes meant to be passed to the native command or use of PowerShell syntax that is not meant to be interpreted as PowerShell.  PowerShell has a `--%` special argument when used with native commands treats the rest of the arguments as literals passed to the native command, but has several issues:\r\n\r\n1. It is not discoverable, users need to know about this special parameter ahead of time\r\n2. `|`, `\u0026\u0026`, and `||` take precedence, so: `wsl --% ls | less` would execute `wsl ls` and pipe the results to `less` running in PowerShell rather than `less` running in wsl\r\n3. If you cut and paste a command line, you would need to edit the line to insert `--%` towards the beginning\r\n4. On Unix systems, the args after --% are passed verbatim w/o globbing where native commands on Unix expect the shell to perform globbing\r\n\r\n## Proposed technical implementation details\r\n\r\nProposal is to introduce a new `--%` (Call Native) operator.\r\n\r\nAny text content after this operator will call into the \"default shell\" of the OS to execute.  On Windows, this would be cmd.exe and on Unix-based systems this would be /bin/sh.  This resolves the globbing issue on Unix-based systems, and also allow `%variable%` expansion on Windows.  Unlike `--%` switch, this also means that `|`, `\u0026\u0026`, and `||` are treated as part of the native command line.\r\n\r\nThis means that these two are functionally the same:\r\n\r\n```powershell\r\nwsl --% ls $foo `\u0026`\u0026 echo $PWD\r\n```\r\n\r\n```powershell\r\n--% wsl ls $foo \u0026\u0026 echo $PWD\r\n```\r\n\r\nwhere `$foo` and `$PWD` is evaluated by the shell within WSL.  Note that in the first example, you would have to know to escape `\u0026\u0026` to have it execute within WSL instead of within PowerShell.\r\n\r\nTo pipe output from such execution back into PowerShell, the user is required to store the results into a variable first:\r\n\r\n```powershell\r\n$out = --% ls *.txt\r\n$out | select-string hello\r\n```\r\n\r\nNote that unlike the current `\u0026` call operator, you cannot use any PowerShell syntax, so:\r\n\r\n```powershell\r\n--% $commandline\r\n```\r\n\r\nwould not resolve `$commandline` as a variable first by PowerShell, but instead pass `$commandline` to the default shell to process unresolved.\r\n\r\nThe cut \u0026 paste problem is solved by simply pasting after `--% ` is typed.\r\n\r\nThe above example for wsl would look like:\r\n\r\n```powershell\r\n--% wsl ls | less\r\n```\r\n\r\nwhere the intent is to have that whole line execute within the WSL Linux instance.\r\n\r\n## Discoverability\r\n\r\nUsers already familiar with `--%` as a switch may easily transition to using this new operator where it makes sense.  For new users, `--%` is unique so that search engines find it easily related to PowerShell.\r\n\r\n## Alternate Considerations\r\n\r\n`\u0026!` and `\u0026n` were proposed as the sigil, but there was push back because `\u0026!` is a valid operator in some languages making a web search for documentation more difficult.  There was also a concern whether visual similar to `\u0026` call operator would be confusing to users.\r\n\r\nThere is question about supporting line-continuation when using this new operator.  I would suggest that we do not support it initially.\r\n\r\nA cmdlet solution instead of an operator solution was proposed.  We believe this doesn't solve the \"cut \u0026 paste\" problem as now you need to know to put the pipeline in single quotes and/or escape special characters.  We do believe a cmdlet as in `Invoke-NativeCommand` (noun to be determined) would be useful as an additional option instead of replacing the need for an operator.\r\n\r\n## Related issues\r\n\r\nThis should also solve these issues:\r\n\r\nhttps://github.com/PowerShell/PowerShell/issues/12491\r\nhttps://github.com/PowerShell/PowerSHell/issues/1761\r\n","author":{"url":"https://github.com/SteveL-MSFT","@type":"Person","name":"SteveL-MSFT"},"datePublished":"2020-06-30T20:53:26.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":210},"url":"https://github.com/13068/PowerShell/issues/13068"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:1118aab1-5d2e-85f6-83dd-479f0ab01c7e
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9A62:24328B:A334E63:D866593:696E2021
html-safe-nonceaa3c2d72c665b0373166fd08ace1dbf384d91dee28d0ff4b913c568430c6d45f
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QTYyOjI0MzI4QjpBMzM0RTYzOkQ4NjY1OTM6Njk2RTIwMjEiLCJ2aXNpdG9yX2lkIjoiNDI3MDQ0MzAwODczODg2MTA4OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac57a4d83fd923b9908317ea7d9501233c2016cb3d8c596414a36db20003e79b98
hovercard-subject-tagissue:648485701
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/PowerShell/PowerShell/13068/issue_layout
twitter:imagehttps://opengraph.githubassets.com/2e6a6f95d9be1191cbf63cef43de2092b9866e561c850ae6f27e387719d7223b/PowerShell/PowerShell/issues/13068
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/2e6a6f95d9be1191cbf63cef43de2092b9866e561c850ae6f27e387719d7223b/PowerShell/PowerShell/issues/13068
og:image:altProblem Statement Currently, there are cases where cutting and pasting a native command line fails to run as expected in PowerShell. This may be due to incorrect parsing of quotes meant to be passe...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameSteveL-MSFT
hostnamegithub.com
expected-hostnamegithub.com
None2fbe8cba5e260284c10af515699ff9bb2d6ace05ab6c2e2e585b71d93b2812c3
turbo-cache-controlno-preview
go-importgithub.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git
octolytics-dimension-user_id11524380
octolytics-dimension-user_loginPowerShell
octolytics-dimension-repository_id49609581
octolytics-dimension-repository_nwoPowerShell/PowerShell
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id49609581
octolytics-dimension-repository_network_root_nwoPowerShell/PowerShell
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
release7fb3bc5c995a876085291706b75cf9b08900c338
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/PowerShell/PowerShell/issues/13068#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPowerShell%2Fissues%2F13068
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%2FPowerShell%2FPowerShell%2Fissues%2F13068
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=PowerShell%2FPowerShell
Reloadhttps://patch-diff.githubusercontent.com/PowerShell/PowerShell/issues/13068
Reloadhttps://patch-diff.githubusercontent.com/PowerShell/PowerShell/issues/13068
Reloadhttps://patch-diff.githubusercontent.com/PowerShell/PowerShell/issues/13068
PowerShell https://patch-diff.githubusercontent.com/PowerShell
PowerShellhttps://patch-diff.githubusercontent.com/PowerShell/PowerShell
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2FPowerShell%2FPowerShell
Fork 8.1k https://patch-diff.githubusercontent.com/login?return_to=%2FPowerShell%2FPowerShell
Star 51.2k https://patch-diff.githubusercontent.com/login?return_to=%2FPowerShell%2FPowerShell
Code https://patch-diff.githubusercontent.com/PowerShell/PowerShell
Issues 1.2k https://patch-diff.githubusercontent.com/PowerShell/PowerShell/issues
Pull requests 212 https://patch-diff.githubusercontent.com/PowerShell/PowerShell/pulls
Discussions https://patch-diff.githubusercontent.com/PowerShell/PowerShell/discussions
Actions https://patch-diff.githubusercontent.com/PowerShell/PowerShell/actions
Projects 7 https://patch-diff.githubusercontent.com/PowerShell/PowerShell/projects
Security Uh oh! There was an error while loading. Please reload this page. https://patch-diff.githubusercontent.com/PowerShell/PowerShell/security
Please reload this pagehttps://patch-diff.githubusercontent.com/PowerShell/PowerShell/issues/13068
Insights https://patch-diff.githubusercontent.com/PowerShell/PowerShell/pulse
Code https://patch-diff.githubusercontent.com/PowerShell/PowerShell
Issues https://patch-diff.githubusercontent.com/PowerShell/PowerShell/issues
Pull requests https://patch-diff.githubusercontent.com/PowerShell/PowerShell/pulls
Discussions https://patch-diff.githubusercontent.com/PowerShell/PowerShell/discussions
Actions https://patch-diff.githubusercontent.com/PowerShell/PowerShell/actions
Projects https://patch-diff.githubusercontent.com/PowerShell/PowerShell/projects
Security https://patch-diff.githubusercontent.com/PowerShell/PowerShell/security
Insights https://patch-diff.githubusercontent.com/PowerShell/PowerShell/pulse
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/PowerShell/PowerShell/issues/13068
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/PowerShell/PowerShell/issues/13068
Call native operatorhttps://patch-diff.githubusercontent.com/PowerShell/PowerShell/issues/13068#top
Committee-ReviewedPS-Committee has reviewed this and made a decisionhttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Committee-Reviewed%22
Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifhttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Discussion%22
Issue-Enhancementthe issue is more of a feature request than a bughttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Enhancement%22
KeepOpenThe bot will ignore these and not auto-closehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22KeepOpen%22
https://github.com/SteveL-MSFT
https://github.com/SteveL-MSFT
SteveL-MSFThttps://github.com/SteveL-MSFT
on Jun 30, 2020https://github.com/PowerShell/PowerShell/issues/13068#issue-648485701
#12491https://github.com/PowerShell/PowerShell/issues/12491
#1761https://github.com/PowerShell/PowerShell/issues/1761
Committee-ReviewedPS-Committee has reviewed this and made a decisionhttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Committee-Reviewed%22
Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifhttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Discussion%22
Issue-Enhancementthe issue is more of a feature request than a bughttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Enhancement%22
KeepOpenThe bot will ignore these and not auto-closehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22KeepOpen%22
Shellhttps://github.com/orgs/PowerShell/projects/31
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.