I would like to modify the standard PowerShell profile in Windows if the Powershell opens inside VS Code integrated terminal (when you are editing e.g. python scripts in VS Code, rather than PS scripts, which opens the ISE profile in any case).
Is there some environmental variable that gets set by the integrated PowerShell? Or is there some way of opening Powershell with a particular profile, instead of the default?
Thanks
PowerShell TerminalIf you are running VS Code on Linux, your default terminal will be Bash. To change to PowerShell, you can modify the Terminal Settings by clicking the drop down in the Terminal and clicking Configure Terminal Settings.
By contrast, the PowerShell Integrated Console is a special shell that comes with the PowerShell extension and offers integration with PowerShell code being edited, notably to provide linting and debugging support, among other features.
VS Code creates an environment variable named TERM_PROGRAM
. You can check it for a value of vscode
, something like this:
if($env:TERM_PROGRAM -eq 'vscode') {
# do some stuff...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With