Powershell add to path, temporarily

Option 1: Modify the $env:Path Variable

  1. Append to the Path variable in the current window:

    $env:Path += ";C:\New directory 1;C:\New directory 2"
    
  2. Prefix the Path variable in the current window:

    $env:Path = "C:\New directory 1;C:\New directory 2;" + $env:Path
    
  3. Replace the Path variable in the current window (use with caution!):

    $env:Path = "C:\New directory 1;C:\New directory 2"
    

Option 2: Use the editenv Utility

I wrote a Windows command-line tool called editenv that lets you interactively edit the content of an environment variable. It works from a Windows console (notably, it does not work from the PowerShell ISE):

editenv Path

This can be useful when you want to edit and rearrange the directories in your Path in a more interactive fashion, and it affects only the current window.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)