Last active
January 23, 2024 03:02
-
-
Save gabriel-vanca/38326aff0db80fd96d14646af3531d4e to your computer and use it in GitHub Desktop.
Refreshing PowerShell Terminal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Write-Host "Refreshing terminal" | |
.$PROFILE | |
# ($NULL -eq $IsWindows) checks for Windows Sandbox enviroment | |
if($IsWindows -or ($NULL -eq $IsWindows)) { | |
# Expected path of the choco.exe file. | |
$chocoInstallPath = "$Env:ProgramData/chocolatey/choco.exe" | |
if(Test-Path -path $chocoInstallPath) { | |
# Make `refreshenv` available right away, by defining the $env:ChocolateyInstall | |
# variable and importing the Chocolatey profile module. | |
$env:ChocolateyInstall = Convert-Path "$((Get-Command choco).Path)\..\.." | |
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" | |
Update-SessionEnvironment | |
refreshenv | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment