Title: Some cmdlets don't respect `-LiteralPath` when it comes to backslashes · Issue #8158 · PowerShell/PowerShell · GitHub
Open Graph Title: Some cmdlets don't respect `-LiteralPath` when it comes to backslashes · Issue #8158 · PowerShell/PowerShell
X Title: Some cmdlets don't respect `-LiteralPath` when it comes to backslashes · Issue #8158 · PowerShell/PowerShell
Description: Path normalization (fixing of slashes) is happening regardless of whether -literalpath is used. Seen in Set-Content, Get-Content, Out-File (maybe others, search for NormalizePath() Steps to reproduce # on Unix based system Set-Content -L...
Open Graph Description: Path normalization (fixing of slashes) is happening regardless of whether -literalpath is used. Seen in Set-Content, Get-Content, Out-File (maybe others, search for NormalizePath() Steps to reprodu...
X Description: Path normalization (fixing of slashes) is happening regardless of whether -literalpath is used. Seen in Set-Content, Get-Content, Out-File (maybe others, search for NormalizePath() Steps to reprodu...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/8158
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Some cmdlets don't respect `-LiteralPath` when it comes to backslashes","articleBody":"Path normalization (fixing of slashes) is happening regardless of whether `-literalpath` is used. Seen in `Set-Content`, `Get-Content`, `Out-File` (maybe others, search for `NormalizePath()`\r\n\r\nSteps to reproduce\r\n------------------\r\n\r\n```powershell\r\n# on Unix based system\r\nSet-Content -LiteralPath \"\\foo.txt\" -Value \"bar\"\r\n```\r\n\r\nExpected behavior\r\n-----------------\r\n\r\n```none\r\nA file called \"\\foo.txt\" is created with content \"bar\"\r\n```\r\n\r\nActual behavior\r\n---------------\r\n\r\nPath normalization (fixing slashes) doesn't take into account that this is a literal path.\r\n\r\n```none\r\nSet-Content : Access to the path '/foo.txt' is denied.\r\nAt line:1 char:1\r\n+ Set-Content -LiteralPath \"\\foo.txt\" -Value \"bar\"\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n+ CategoryInfo : PermissionDenied: (/foo.txt:String) [Set-Content], UnauthorizedAccessException\r\n+ FullyQualifiedErrorId : GetContentWriterUnauthorizedAccessError,Microsoft.PowerShell.Commands.SetContentCommand\r\n```\r\n\r\nEnvironment data\r\n----------------\r\n\r\n\u003c!-- provide the output of $PSVersionTable -->\r\n\r\n```powershell\r\nName Value\r\n---- -----\r\nPSVersion 6.2.0-preview.1\r\nPSEdition Core\r\nGitCommitId 6.2.0-preview.1\r\nOS Darwin 18.0.0 Darwin Kernel Version 18.0.0: Wed Aug 22 20:13:40 PDT 2018; root:xnu-4903.201.2~1/RELEASE_X86_64\r\nPlatform Unix\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\nWSManStackVersion 3.0\r\n```\r\n","author":{"url":"https://github.com/SteveL-MSFT","@type":"Person","name":"SteveL-MSFT"},"datePublished":"2018-10-31T16:26:04Z","url":"https://github.com/PowerShell/PowerShell/issues/8158"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:e2e40091-af5f-66fd-3f74-e46cfcf0fdaf |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8B26:70C53:1E5C0E:2A0A74:6AFD8098 |
| html-safe-nonce | 774727eb3b69195c4b280385f394c405146b6b29e77feed330e61e2050064d9b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QjI2OjcwQzUzOjFFNUMwRToyQTBBNzQ6NkFGRDgwOTgiLCJ2aXNpdG9yX2lkIjoiMzQwMDA1MzM2OTI0MTE3NDE2OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | a70b1daa06dbe1eaebfe3fb81f0073e50ed5a41e6f75e69d12c329a507258385 |
| hovercard-subject-tag | issue:376050163 |
| 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/8158/issue_layout |
| twitter:image | https://opengraph.githubassets.com/97d0072c723308030474f6c021f6dd08a25ff5b74a68955978d59bd22b58e7f0/PowerShell/PowerShell/issues/8158 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/97d0072c723308030474f6c021f6dd08a25ff5b74a68955978d59bd22b58e7f0/PowerShell/PowerShell/issues/8158 |
| og:image:alt | Path normalization (fixing of slashes) is happening regardless of whether -literalpath is used. Seen in Set-Content, Get-Content, Out-File (maybe others, search for NormalizePath() Steps to reprodu... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | SteveL-MSFT |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42d4967e3c8afca51ccac31f419a705af777226a95f025ea73387d87a306b326 |
| 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 | 2329ceed0bc2c7b7c3b9f5f2db6abfc7b6fc3a50 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width