1

i'm installing among other things sliksvn subversion client using the powershell command below but during the install i assume it must add the svn executable to the PATH environment variable which means svn commands running in the same windows after the install fail due to the svn.exe not being on the PATH, is there any way to reload the PATH variable without have to close and reopen the powershell window?

i could use the full path to svn.exe but i'm trying to avoid this if possible

Install Script

Start-Process -Wait -FilePath "$($pwd.path)\assets\Slik-Subversion-1.9.7-x64.msi" -ArgumentList "/passive";
  • Why don’t you just use the full path to the executable? This way you avoid the limits of the PATH variable? – Ramhound Jul 10 '18 at 11:11
  • Really it's only for readability reasons svn export --username blah -password blah <url_here> is slightly easier to read than "C:\Program Files\SlikSvn\bin\svn.exe" export --username blah -password blah <url_here> admittedly there's not a huge amount in it. – Snipzwolf Jul 10 '18 at 11:18
  • 1
    Set-Alias -Name slvn -Value "C:\Program Files\SlikSvn\bin\svn.exe"; slvn export --username blah -password blah <url_here> – EBGreen Jul 10 '18 at 11:43
  • @EBGreen this seems like a pretty good alternative and might use it instead if it's not possible to update path in an existing session, Thanks. – Snipzwolf Jul 10 '18 at 13:05
5

AFAIK, the PATH can be reloaded within Powershell like this:

$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine")

or

$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") 
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.