In Microsoft's VSCode, I want to customize the integrated PowerShell prompt like I can with my .bash_profile.

It appears you can edit it to your liking according to this document, but I am unsure where to save my .ps1 file with the function prompt { } , and unsure how to get VSCode to invoke it when opening a new console.

It seems every session sets up a temporary profile in Users/<username>/.config/powershell/Microsoft.VSCode_profile.ps1, but doing a ls on my ~/.config directory shows no powershell directory whatsoever. If I create the directory, will VSCode read it when I open a console?

Has anyone succeeded with this?

Output from Get-Host:

Name             : Visual Studio Code Host
Version          : 1.11.0
InstanceId       : 8d0a98e7-12e1-41b1-b27e-02879107cf00
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-US
CurrentUICulture : en-US
PrivateData      : Microsoft.PowerShell.EditorServices.EditorServicesPSHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace

2 Answers 2


Did some experimenting. Yes, create ~/.config/powershell if it doesn't exist, and save your profile in a file named exactly Microsoft.VSCode_profile.ps1


function prompt {
    "$(Get-Date) $(Resolve-Path -Relative -Path $(Get-Location))> "

...will return something like this if your path is /Users/<you>/Documents/powershellscripts/

03/11/2019 20:11:32 ../powershellscripts>
  • Correct, you need the profile for such use cases, and again, you have to set OSX to start with pwsh.exe in the user setting of VSCode by setting the terminal path and that part is in the terminal section of the docs.
    – postanote
    Mar 12, 2019 at 3:48

This is fully documented in the VSCode docs and on this site and all over the web.

A simple search using 'vscode custom prompt' would give the links for this use case.

It's just a function you add to your profile. I like to keep things a simple as possible, so, here mine on Windows. It's a blank prompt line with the path displayed in the GUI title bar that I use for all my profiles (PowerShell, ISE, VSCode).

Function Prompt 
    # get the last command from history
    $command = Get-History -Count 1

    # set it to the window title
    if ($command) 
        $CurrentUser = [System.Security.Principal.WindowsIdentity]::GetCurrent() 
        $principal = new-object System.Security.principal.windowsprincipal($CurrentUser)
        if ($principal.IsInRole("Administrators")) { $Role = 'Administrator: ' }
        Else { $Role = 'User: ' }

        $host.ui.rawui.WindowTitle = $Role + $PWD

    # specify your custom prompt, e.g. the default PowerShell:
    " "

So, the above works, but in VSCode, it does not change the title bar, because that is tied to the file you have open. Yet, you are just looking at the prompt. So, this approach should get you there.

This has been covered on stackexchange as well..

How to customize the shell prompt in the VS Code terminal on macOS

Also, see the VSCode docs for more on the terminal setup / customization.

Integrated Terminal

In Visual Studio Code, you can open an integrated terminal, initially starting at the root of your workspace. This can be convenient as you don't have to switch windows or alter the state of an existing terminal to perform a quick command-line task.

  • Please note that I was asking specifically about the PowerShell console that comes with the PowerShell extension. While there are documents and posts everywhere regarding the default terminal (VSCode defaults to bash on Mac), I searched exhaustively for PowerShell specific docs/SE questions, and could not find them.
    – DrKumar
    Mar 12, 2019 at 3:40
  • You have to set OSX to default to PowerShell. For this... Name : Visual Studio Code Host … it's the same prompt function. That console, is the ISE version of the console in VSCode. You still have the console host one as well and can be run together as needed. Of course you can add others. You just set it using the OSX paths / format you'd want.
    – postanote
    Mar 12, 2019 at 3:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .