Title: `Resolve-Path -Relative`: `-RelativeBasePath` accepts wildcard expressions, reports different results when matched via wildcard · Issue #20931 · PowerShell/PowerShell · GitHub
Open Graph Title: `Resolve-Path -Relative`: `-RelativeBasePath` accepts wildcard expressions, reports different results when matched via wildcard · Issue #20931 · PowerShell/PowerShell
X Title: `Resolve-Path -Relative`: `-RelativeBasePath` accepts wildcard expressions, reports different results when matched via wildcard · Issue #20931 · PowerShell/PowerShell
Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerShell 5.1 and PowerShell. Steps to reprodu...
Open Graph Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
X Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/20931
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`Resolve-Path -Relative`: `-RelativeBasePath` accepts wildcard expressions, reports different results when matched via wildcard","articleBody":"### Prerequisites\r\n\r\n- [X] Write a descriptive title.\r\n- [X] Make sure you are able to repro it on the [latest released version](https://github.com/PowerShell/PowerShell/releases)\r\n- [X] Search the existing issues.\r\n- [X] Refer to the [FAQ](https://github.com/PowerShell/PowerShell/blob/master/docs/FAQ.md).\r\n- [X] Refer to [Differences between Windows PowerShell 5.1 and PowerShell](https://learn.microsoft.com/powershell/scripting/whats-new/differences-from-windows-powershell).\r\n\r\n### Steps to reproduce\r\n\r\nNote:\r\n\r\n* I think`-RelativeBasePath` shouldn't even _accept_ wildcard expressions, so to me the preferable resolution is to simply treat `-RelativePath` arguments as _literal_ paths. (Currently, a wildcard is accepted, but only if it resolves to _exactly one item_).\r\n\r\n * There is precedent for making such a - technically breaking - change, e.g the `-OutFile` parameter of `Invoke-WebRequest` and `-InvokeRestMethod`, which used to accept wildcards, but now interprets paths literally - see https://github.com/PowerShell/PowerShell/pull/11701#issuecomment-579756979\r\n\r\n* Doing so would make the problem at hand go away; if this is decided against, at least the inconsistency below must be fixed.\r\n\r\n```powershell\r\n# Matching with *literal* path.\r\nResolve-Path System32 -Relative -RelativeBasePath C:\\Windows\r\n\r\n# Matching the same path *via wildcard*\r\nResolve-Path System32 -Relative -RelativeBasePath C:\\Window[s]\r\n```\r\n\r\n### Expected behavior\r\n\r\n```console\r\n.\\System32\r\n.\\System32\r\n```\r\n\r\n\r\n### Actual behavior\r\n\r\n```console\r\n.\\System32\r\n..\\Windows\\System32\r\n```\r\n\r\nThat is, even though in both commands `C:\\Windows` was ultimately used as the base path, the wildcard matching resulted in different output.\r\n\r\n\r\n### Error details\r\n\r\n_No response_\r\n\r\n### Environment data\r\n\r\n```powershell\r\nPowerShell 7.4.0\r\n```\r\n\r\n\r\n### Visuals\r\n\r\n_No response_","author":{"url":"https://github.com/mklement0","@type":"Person","name":"mklement0"},"datePublished":"2023-12-14T19:35:43.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/20931/PowerShell/issues/20931"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:38c06a11-657a-c268-ba8b-3cfd62fc5b9a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8C64:E9032:CB05E6:12465C9:6A58D4CB |
| html-safe-nonce | 3c2438afda6afdde4d0db0e073fdd7ba6be02f01d5b86de7c8fc5b2d295e09b0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QzY0OkU5MDMyOkNCMDVFNjoxMjQ2NUM5OjZBNThENENCIiwidmlzaXRvcl9pZCI6IjQyMzYwMTQzNDkwNDYwNDM4NTEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b10fb70b8f7f450ee67c84e5ca69ce484f3c02a118d1026dcd2570cc1caf6773 |
| hovercard-subject-tag | issue:2042346471 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/20931/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d13ee2bdd2264f21ba875cf2725656496132862a4b79dcfbd536c03f1302808e/PowerShell/PowerShell/issues/20931 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d13ee2bdd2264f21ba875cf2725656496132862a4b79dcfbd536c03f1302808e/PowerShell/PowerShell/issues/20931 |
| og:image:alt | Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mklement0 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f2a0c7865178af3d91dd9f13b0cdfc3c73a2529c873d2780bb4c01271a57ec6 |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8aae7b8d6caacacf5c66eaeb2702d8dc88d85b4a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width