Set the PATH environment variable for .NET tools in your PowerShell profile

2008-08-05 11:07:41 by Kjell-Åke Gafvelin

To set the PATH environment variable for your PowerShell profile you have to do the following:

  1. Make sure you have a folder called WindowsPowerShell in My Documents.
  2. Create a file called profile.ps1 in the new folder and open it.
  3. Copy the following into the new file:
  4. $paths = @();
    $paths += $env:PATH;
    $paths += join-path (get-itemproperty "HKLM:SOFTWARE\Microsoft\Microsoft SDKs\Windows").CurrentInstallFolder "bin";
    $paths += join-path (get-itemproperty "HKLM:SOFTWARE\Microsoft\.NETFramework").InstallRoot "v2.0.50727";
    $env:PATH = [string]::Join(";", $paths);
  5. Close  the file.
  6. Open a new PowerShell prompt.