I have a PowerShell script which contains a single command:
pwd
When I execute it from a (Windows 10) command line window, I get the following:
d:\Hudson_Test\workspace\CadGraphics>echo %cd%
d:\Hudson_Test\workspace\CadGraphics
d:\Hudson_Test\workspace\CadGraphics>powershell -file ShowLocation.ps1
Path
----
D:\hudson_test\workspace
As you can see, the current directory moves up one directory (from d:\hudson_test\workspace\CadGraphics to D:\hudson_test\workspace) when inside the PowerShell script.
I tested this on another (Win10) machine, and on that machine, the two paths were the same.
What is going on here, and how can I keep it from happening?
notepad $profileto check. Sounds like you have a profile that is setting the location. You can launch powershell without executing your profile withpowershell -NoProfile -File ShowLocation.ps1