Title: Discussion: Use literal paths for OutFile parameter on Invoke-RestMethod / Invoke-WebRequest · Issue #3174 · PowerShell/PowerShell · GitHub
Open Graph Title: Discussion: Use literal paths for OutFile parameter on Invoke-RestMethod / Invoke-WebRequest · Issue #3174 · PowerShell/PowerShell
X Title: Discussion: Use literal paths for OutFile parameter on Invoke-RestMethod / Invoke-WebRequest · Issue #3174 · PowerShell/PowerShell
Description: When using square brackets in the OutFile parameter of the web cmdlets the square brackets in the path act as a wildcard option/range operator. Hence any square brackets in the OutFile parameter causes an error for the cmdlets. Personall...
Open Graph Description: When using square brackets in the OutFile parameter of the web cmdlets the square brackets in the path act as a wildcard option/range operator. Hence any square brackets in the OutFile parameter ca...
X Description: When using square brackets in the OutFile parameter of the web cmdlets the square brackets in the path act as a wildcard option/range operator. Hence any square brackets in the OutFile parameter ca...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/3174
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Discussion: Use literal paths for OutFile parameter on Invoke-RestMethod / Invoke-WebRequest","articleBody":"When using square brackets in the OutFile parameter of the web cmdlets the square brackets in the path act as a wildcard option/range operator.\r\nHence any square brackets in the OutFile parameter causes an error for the cmdlets.\r\nPersonally, when downloading a file, I always use a literal path, instead of specifying a file with wildcard support.\r\n\r\nI would like to start a discussion if it makes sense to treat the OutFile parameter as a literal path.\r\nAny opinions on that?\r\n\r\nMaybe someone could contribute scenarios where wildcard support makes sense.\r\n\r\nNote: Of course there are several workarounds in PowerShell to overcome this minor lack of comfort.\r\n\r\nSteps to reproduce\r\n------------------\r\n```powershell\r\nInvoke-WebRequest https://raw.githubusercontent.com/PowerShell/PowerShell/master/README.md -OutFile ReadMe[Powershell].md\r\n```\r\nExpected behavior\r\n-----------------\r\nCreates a ReadMe[Powershell].md file in current directory.\r\n\r\nActual behavior\r\n---------------\r\n```powershell\r\nInvoke-WebRequest : Cannot perform operation because the wildcard path ReadMe[Powershell].md did not resolve to a file.\r\nAt line:1 char:1\r\n+ Invoke-WebRequest https://raw.githubusercontent.com/PowerShell/PowerS ...\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n + CategoryInfo : OpenError: (ReadMe[Powershell].md:String) [Invoke-WebRequest], FileNotFoundException\r\n + FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.InvokeWebRequestCommand\r\n```\r\n\r\nEnvironment data\r\n----------------\r\n\r\n\u003c!-- provide the output of $PSVersionTable --\u003e\r\n\r\n```powershell\r\n\u003e $PSVersionTable\r\nName Value\r\n---- -----\r\nPSVersion 5.1.14393.693\r\nPSEdition Desktop\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}\r\nBuildVersion 10.0.14393.693\r\nCLRVersion 4.0.30319.42000\r\nWSManStackVersion 3.0\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\n```\r\n","author":{"url":"https://github.com/ThreeFive-O","@type":"Person","name":"ThreeFive-O"},"datePublished":"2017-02-20T10:14:55.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":8},"url":"https://github.com/3174/PowerShell/issues/3174"}
| 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:5734c3ef-5b17-02e4-c15a-ba955dea46cf |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A864:385FD:B99B2A:1072CB1:6A588A0A |
| html-safe-nonce | 760838f6e4c33ca5998006fde96c900bfd468274aebce02c0be32f92373c11c3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBODY0OjM4NUZEOkI5OUIyQToxMDcyQ0IxOjZBNTg4QTBBIiwidmlzaXRvcl9pZCI6IjIxNjA1Njg2ODQyNjMyNzkxMTQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3704afb028847e3aa268b7f641345a37c4f0ddf95d92fc457da41b80303d58df |
| hovercard-subject-tag | issue:208836029 |
| 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/3174/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5550bf89ecff368b4ad2d0688c45cc954ed35684c7bbec3ac286cd5ae78c20e3/PowerShell/PowerShell/issues/3174 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5550bf89ecff368b4ad2d0688c45cc954ed35684c7bbec3ac286cd5ae78c20e3/PowerShell/PowerShell/issues/3174 |
| og:image:alt | When using square brackets in the OutFile parameter of the web cmdlets the square brackets in the path act as a wildcard option/range operator. Hence any square brackets in the OutFile parameter ca... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ThreeFive-O |
| 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