Skip to content

Instantly share code, notes, and snippets.

@sengiv
Created August 31, 2023 01:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sengiv/6eaf57113eb275403cb04cefdfa27619 to your computer and use it in GitHub Desktop.
Save sengiv/6eaf57113eb275403cb04cefdfa27619 to your computer and use it in GitHub Desktop.
# Get the current PATH
$currentPath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path
# Your MSBuild path
$msbuildPath = "C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin"
# Create a new PATH
$newPath = $currentPath + ";" + $msbuildPath
# Set the new PATH
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $newPath
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment