Michael Saparov
Posted on December 10, 2023
- Open PowerShell.
Open PowerShell with administrator permission.
- Check PowerShell profile availability:
Check that you have PowerShell profile, run the command:
Test-Path $profile
If you get False, than create profile by running the command:
New-Item -Type File -Force $profile
- Open the profile in editor:
notepad $profile
- Add the code to the profile file:
function prompt {
# Check, if virtual environment is activated by using pipenv shell
if ($env:PIPENV_ACTIVE) {
Write-Host "(pipenv) " -NoNewline -ForegroundColor Cyan
}
# Check, if virtual environment is activated by using venv
elseif ($env:VENV_PROMPT -eq "activated") {
Write-Host "(venv) " -NoNewline -ForegroundColor Cyan
}
"PS $($executionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) "
}
- To change the current value of the PowerShell script launch policy, the Set-ExecutionPolicy cmdlet is used. For example, let's allow local scripts to run:
Set-ExecutionPolicy RemoteSigned
- For further use, restart the terminal
- Result:
💖 💪 🙅 🚩
Michael Saparov
Posted on December 10, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.