Repository navigation
Closed
Labels
Area-FileSystem-Providerspecific to the FileSystem providerIssue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-No ActivityIssue has had no activity for 6 months or moreWG-Cmdletsgeneral cmdlet issues
Description
Steps to reproduce
Steps documented below. $PWD.Path populates, but other members break (returning $null). This behavior does not happen by using Set-Location without piping.
Expected behavior
$ > Set-Location -Path C:\
$ > $PWD.Drive
Name Used (GB) Free (GB) Provider Root
---- --------- --------- -------- ----
C 50.00 100.00 FileSystem C:\
$ > Get-Item -Path C:\Windows | Set-Location
$ > $PWD.Drive
Name Used (GB) Free (GB) Provider Root
---- --------- --------- -------- ----
C 50.00 100.00 FileSystem C:\
$ >Actual behavior
$ > Set-Location -Path C:\
$ > $PWD.Drive
Name Used (GB) Free (GB) Provider Root
---- --------- --------- -------- ----
C 50.00 100.00 FileSystem C:\
$ > Get-Item -Path C:\Windows | Set-Location
$ > $PWD.Drive
$ >Environment data
Name Value
---- -----
PSVersion 6.2.0
PSEdition Core
GitCommitId 6.2.0
OS Microsoft Windows 6.1.7601 S
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Reacted by Michael Klement, Alejandro Barreto and Andy Zivkovic
Reacted by Rain Sallow (/u/ta11ow)
Metadata
Metadata
Assignees
Labels
Area-FileSystem-Providerspecific to the FileSystem providerIssue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-No ActivityIssue has had no activity for 6 months or moreWG-Cmdletsgeneral cmdlet issues
Activity
vexx32 commentedon Apr 4, 2019
The issue isn't the pipe here, it's the type of item you're providing. You're piping in a
DirectoryInfoobject and not a string, which seems to cause Set-Location to actually use thePSPathproperty, seen here:Either the
Set-Locationcommand needs to be updated to normalize the path it's using properly, or whatever it's calling that causes $pwd to be updated needs to be fixed. Ideally, I'd want both fixed to double-check each other, tbh, just in case someone tries to be funny and update it themselves somehow in a weird way.morsley commentedon Apr 4, 2019
Rain Sallow (/u/ta11ow) (@vexx32) Thanks for the additional digging. I found this behavior also exists on Windows PowerShell. I noticed it because it kept breaking
$Function:promptvexx32 commentedon Apr 4, 2019
Aaaand I figured out a way to fix it.
mklement0 commentedon Sep 12, 2019
Update: This may be a separate problem - see #10522
As of 7.0.0-preview.3, the problem is now more conspicuous:
Note the broken current location reported via the
promptfunction, based on the stringification of$executionContext.SessionState.Path.CurrentLocation(effectively, its.Pathproperty).(As an aside: on Windows you'd get
PS Microsoft.PowerShell.Core\FileSystem::C:\>, but on Unix the/gets eaten.)[-]Piping to `Set-Location` breaks `$PWD`[/-][+]`Set-Location` breaks `$PWD`[/+]microsoft-github-policy-service commentedon Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 23, 2023
This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.