Use the PowerShell Console from within Visual Studio Code

I recently revisited Visual Studio Code. I was looking for a markdown editor and remembered seeing a tweet a few weeks ago saying that VS Code could be used to edit markdown. It supports markdown by default, although I would recommend adding a spell check extension to it.

I thought that it would be convenient if I could write my PowerShell code right from within the same interface that I’m writing other things such as markdown. One of the problems that I previously experienced with VS Code is there wasn’t a PowerShell console pane like in the ISE (Integrated Scripting Environment). Based on the release notes for VS Code, back in May of 2016, version 1.2.0 was released and added support for an Integrated Terminal which uses the cmd.exe command prompt by default on a Windows system. As you’ll see in this blog article, it’s really easy to change the integrated terminal to use PowerShell.exe instead of cmd.exe.

If you haven’t already installed Visual Studio Code and the PowerShell extension for it, take a look at my blog article titled “Installing Visual Studio Code and the PowerShell Extension“.

Open VS Code. Select File > Preferences > User Settings:


There’s a setting in the default settings that references cmd.exe as the terminal:


A settings.json file is also opened when “User Settings” is selected. It allows any of the default settings to be overwritten. Based on the Integrated Terminal documentation page that was previously referenced, place the following entry in the settings.json file to make PowerShell.exe the default integrated terminal program:


Save the settings.json file. Close and reopen VS Code.

Open the Integrated Terminal from View > Integrated Terminal or with the Ctrl + ` keyboard shortcut:


Now you can run PowerShell code via the PowerShell console right from within Visual Studio Code:


I also found the following two Visual Studio documentation articles helpful and interesting:

User and Workspace Settings
Markdown and VS Code



  1. vernanderson

    Mike you never cease to amaze me!!!

  2. don

    Nice article. How can I get my integrated PowerShell terminal in VS Code to have color coded text like yours? Mine is just gray on black.

  3. David Wallis

    Dont suppose you know if you can change the right click on a folder from CMD to powershell do you???

  4. Winsto

    Nice one, thank you.

  5. powershell nubie

    I use windows 10, I tried the above and it does not work, when I did the above.

    which version of windows are you using for the above tweak

  6. anony

    I will keep using ISE. ISE is still far better than visual studio code. Its intellisense is far superior , e.g if you run this line in the ISE editor

    $myresponse = Invoke-RestMethod -Uri

    then if you go to the integrated terminal/console in ISE, you can type $myresponse. and and its intellisense jumps in right away with the contents of $myresponse

    it allows you to drill down into the $myresponse and will display “restresponse” then “result” and “messages” so that you can just select the one you need and drill down to the level of information you want.

    try this in VSCODE, its intellisense does not even detect and display “restresponse”, “result”, “messages” .

  7. TeeStar

    I don’t know why you would want to use Visual Studio Code instead of the ISE. To me at least it seems like it is a major step backwards. there is no tool bar, commands side window. ISE is much easier to use in my opinion. I don’t know, maybe I am missing something?

  8. Mike Baker

    There doesn’t seem to be any command history in the VS Code powershell terminal. This is a deal breaker for me

  9. Lord Felix

    TeeStar, The benefit is for small operations, where you don’t need ISE. Such as for migrations to database (ex. Add-Migration, etc.). This is just one example.
    This solution is helpful, however it would be great if I could just choose whether I want to select CMD terminal or Powershell from the selection menu. I thought that was an option, was it removed in an update? … seems strange, I remember seeing this option and now it’s not there (in VS Code).

  10. westerdaled

    Hi, this is a good post and one of those I followed to set this up . The other is: . So I can switch between

    “”: [{
    “shell”: “c:\\Program Files\\PowerShell\\6-preview\\pwsh.exe”,
    “label”: “PowerShell Core”
    “shell”: “C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe”,
    “label”: “Windows PowerShell”

    My only moan is the the label 2.PWSh isn’t exactly descriptive which means I am bound to forget what this is or whether this RC or GA version. Anybody else noticed this


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: