[Environment]::CurrentDirectory is the Current Directory?
See original GitHub issueSteps to reproduce
PS > Set-Location /
PS > (Get-Location).Path
/
PS > [Environment]::CurrentDirectory
/home/user
Expected behavior
PS > Set-Location /
PS > (Get-Location).Path
/
PS > [Environment]::CurrentDirectory
/
Actual behavior
[Environment]::CurrentDirectory
shows not “Current Directory”, rather “Start Directory”
Environment data
Name Value
---- -----
PSVersion 7.1.2
PSEdition Core
GitCommitId 7.1.2
OS Linux 5.10.15-172.current #1 SMP PREEMPT Fri Feb 12 16:35:57 UTC 2021
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Environment.CurrentDirectory Property (System)
Gets or sets the fully qualified path of the current working directory.
Read more >c# - Environment.CurrentDirectory vs System.IO.Directory. ...
I think this technique is appropriate for a relatively small number of readonly configuration files, with all files existing at build time. If ......
Read more >C# - Environment.CurrentDirectory Property with Example
CurrentDirectory property is used to set and get the path of the current directory. Syntax. string Environment.CurrentDirectory. Parameter(s).
Read more >C# Program to Get the Full Path of the Current Directory ...
In C#, Environment Class provides information about the current platform and manipulates, the current platform. It is useful for getting and ...
Read more >Question about Environment.CurrentDirectory - Studio
HI @ushu. Yes it will work. In the Orchestrator the Current Directory is. C:\Users\Domain Name.nuget\packages\Process Name\1.0.8\lib\net45.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
[Environment]::CurrentDirectory
refers to the process wide working directory. This is different from the PowerShell location which is specific to the Runspace the pipeling is running in. They are not designed to impact each other because:In short you should always resolve your paths to the absolute path before calling any .NET functions. This will ensure that any relative directories are relative to PowerShell’s location rather than the process wide currenct directory.
Thank you. I thought I was misunderstood with all these online translators.