diff --git a/activate.ps1 b/activate.ps1 index db7b3c499fe..efd5b6da47b 100644 --- a/activate.ps1 +++ b/activate.ps1 @@ -8,7 +8,6 @@ if ($MyInvocation.InvocationName -ne '.') { } function deactivate ([switch]$init) { - # reset old environment variables if (Test-Path variable:_OLD_PATH) { $env:PATH = $_OLD_PATH @@ -16,12 +15,12 @@ function deactivate ([switch]$init) { } if (test-path function:_old_prompt) { - Set-Item Function:prompt -Value $function:_old_prompt -ea ignore - remove-item function:_old_prompt + Set-Item Function:prompt -Value $function:_old_prompt -ErrorAction Ignore + Remove-Item function:_old_prompt } - Remove-Item env:DOTNET_ROOT -ea ignore - Remove-Item env:DOTNET_MULTILEVEL_LOOKUP -ea ignore + Remove-Item env:DOTNET_ROOT -ErrorAction Ignore + Remove-Item env:DOTNET_MULTILEVEL_LOOKUP -ErrorAction Ignore if (-not $init) { # Remove the deactivate function Remove-Item function:deactivate @@ -44,11 +43,11 @@ if (-not $env:DISABLE_CUSTOM_PROMPT) { $function:_old_prompt = $function:prompt function dotnet_prompt { # Add a prefix to the current prompt, but don't discard it. - write-host -f Green "($( split-path $PSScriptRoot -leaf )) " -nonewline + Write-Host -f Green "($(Split-Path $PSScriptRoot -Leaf)) " -NoNewLine & $function:_old_prompt } - Set-Item Function:prompt -Value $function:dotnet_prompt -ea ignore + Set-Item Function:prompt -Value $function:dotnet_prompt -ErrorAction Ignore } Write-Host -f Magenta "Enabled the .NET Core environment. Execute 'deactivate' to exit."