1

I set PowerShell as my default terminal in Android Studio settings after that I modified my PATH from inside the Android Studio Terminal (PowerShell) like:

$env:PATH = $env:PATH + "C:\SomePath"

However I ommited the ";" at the beginning of "C:\SomePath" by doing this now my last entry in the path looks like "C:\LastEntryC:\SomePath" what is wrong.

How to modify this entry from PowerShell to have "C:\LastEntry;C:\SomePath"?

I tried to change the PATH variable from the Windows Control Panel but it's different, It seems that the PATH in android studio is local to the IDE.

IsaacCisneros
  • 1,953
  • 2
  • 20
  • 30

1 Answers1

3

I ran your command against my own path variable.

$env:PATH = $env:PATH + "C:\SomePath"

Which gave, the tail of my path, the following.

...C:\Program Files (x86)\NmapC:\SomePath

To correct i used a replace command on the path environment variable. The first \ has to be escaped.

$env:PATH = $env:PATH -replace "C:\\SomePath",";C:\SomePath"

Upon further reflection a simpler Idea to this would be just to use -join

$env:PATH = $env:PATH,"C:\SomePath" -join ";"
Matt
  • 45,022
  • 8
  • 78
  • 119
  • I like your short and clear answer! Any ideas why getting the path from my PowerShell terminals (IDE & System) was not the same? – IsaacCisneros Jul 17 '14 at 15:18
  • Not completly sure but it might be scope related: See other post about user and system environment variables. You might have been working with both. http://stackoverflow.com/questions/4477660/what-is-the-difference-between-user-variables-and-system-variables – Matt Jul 17 '14 at 19:41