Not sure how to contact anyone on the PowerShell team, so I'm posting here. I've found what I must call a bug in PowerShell. Here's how to reproduce it.
Start PowerShell, which will put you in $home (for me, this is H:\).
PS H:\> cd 'C:\Program Files'
PS C:\Program Files> get-location
Path
----
C:\Program Files
PS C:\Program Files> [System.IO.Directory]::GetCurrentDirectory()
H:\
PS C:\Program Files>
This behavior, if intentional, is crazy. When you execute other programs, or (as in my case) use COM objects, they won't think the current directory is the directory that the user thinks is the current directory.
What's the deal? Does it behave this way because PS has the concept of locations that don't actually exist (such as when you cd into the registry hive)? If so, then shouldn't there be (an obvious) way to get/set the actual working directory, or better yet,
if the "location" is an actual directory, shouldn't the current working directory be set as well?
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.