1

My path looks like this: enter image description here The top (selected) path contains pandoc.exe and the third from the top (anaconda3) contains pandoc.exe. So the top folder should take priority.

If I launch PowerShell simply by launching "Windows PowerShell.exe", and type gcm pandoc I get the top PATH for pandoc.exe: enter image description here

If I launch PowerShell by shift-right-clicking in explorer and selecting "Open PowerShell window here", and type gcm pandoc.exe, I get the Anaconda PATH for pandoc.exe: enter image description here

What gives? Why does it matter in what way I launch PowerShell?

mklement0
  • 382,024
  • 64
  • 607
  • 775
Gandalf Saxe
  • 381
  • 3
  • 7
  • 3
    1) there isn't a single PATH; environment variables are inherited from the launching process, so they can be different for every process. See if `$env:path` shows up differently in the two powershell sessions. 2) try the trace in https://stackoverflow.com/a/22261212/478656 to see where PS is looking for executables – TessellatingHeckler Jul 18 '18 at 19:47
  • I can reproduce if 1) the directory `.` is in the path and 2) the current directory contains the executable in question. – Bill_Stewart Jul 18 '18 at 19:49
  • 1
    If I run `trace-command -name CommandDiscovery -command ls -PSHost` I get identical results in both consoles. If I run `echo $Env:PATH` in both consoles, I get same results except for: Console 1 opened from context menu: %USERPROFILE%\.dnx\bin Console 2 opened normally: C:\Users\s113093\.dnx\bin C:\Users\s113093\AppData\Roaming\local\bin I.e. crucially it has the `C:\Users\s113093\AppData\Roaming\local\bin` path that makes all the difference. – Gandalf Saxe Jul 18 '18 at 21:48
  • @GandalfSaxe: Is `%USERPROFILE%\.dnx\bin` really reported as such, with the environment-variable reference _unexpanded_? – mklement0 Jul 18 '18 at 22:50
  • It is reported exactly as such in the PowerShell that was launched with Shift+F10 -> Open PoweShell window here. – Gandalf Saxe Jul 20 '18 at 13:10

0 Answers0