How to Install PowerShell and CMD for VS Code | Shell Setup

Pick a shell, set it as the default terminal in VS Code, then confirm your PATH so commands run from any project folder.

VS Code’s integrated terminal is one of those features you either ignore for months or use all day. When it’s set up well, you can run scripts, check Git status, start servers, and troubleshoot builds without leaving the editor. When it’s set up poorly, you get the wrong shell, missing commands, odd quoting behavior, or a terminal that opens in the wrong folder.

This walkthrough gets PowerShell and Command Prompt (CMD) working cleanly inside VS Code, then shows you how to switch between them on demand. The steps center on Windows, since CMD lives there, then include short notes for macOS and Linux so PowerShell feels consistent across machines.

What PowerShell And CMD Mean Inside VS Code

VS Code doesn’t ship with PowerShell or CMD. It detects what’s already installed on your system and lists those shells as terminal profiles. A profile is a named shell plus the path to its executable and any launch arguments.

On Windows, you’ll usually see at least these choices: Windows PowerShell (the built-in one), PowerShell 7 (if you install it), and Command Prompt. You can also add profiles for Git Bash, WSL, or other shells, but we’ll stick with PowerShell and CMD here.

Install PowerShell On Windows With A Clean Baseline

Windows PowerShell 5.1 is included with many Windows installs. It works fine for lots of tasks, yet PowerShell 7 brings newer features, runs side-by-side, and matches what you’ll see on macOS and Linux. If you want the modern edition, install PowerShell 7 and keep 5.1 available as a fallback.

Option A: Install From Microsoft Store

The Store build updates smoothly and stays current through Windows update mechanisms. If your PC can use the Store, it’s a straightforward route.

  • Open Microsoft Store.
  • Search for “PowerShell”.
  • Install the app published by Microsoft.
  • After install, open a terminal and run pwsh to confirm it launches.

Option B: Install Using MSI Or Winget Paths

If you manage machines where the Store is blocked, use Microsoft’s documented install paths, like MSI packages or winget. The official install page also lists what each method does. Microsoft Learn install steps for PowerShell on Windows lay out the choices in one place.

  • Follow the method that fits your device policy (Store, MSI, or winget).
  • After install, open a terminal and run pwsh.
  • Run $PSVersionTable.PSVersion to see the version number.

Quick Check: Is PowerShell On Your PATH?

VS Code can launch a shell even when PATH is messy, yet PATH trouble shows up the moment you try to run tools like git, node, python, or build commands from the terminal panel.

  • In PowerShell, run where pwsh and where powershell.
  • In CMD, run where powershell and where pwsh.
  • If where returns “INFO: Could not find files…”, your install path or PATH needs a fix.

Confirm CMD Is Ready And Know When To Use It

Command Prompt is part of Windows. You don’t “install” it in the usual sense. What you do need is a clean profile inside VS Code, plus an awareness of its syntax.

CMD is great for simple commands and legacy scripts. It can feel awkward for scripting tasks, complex piping, or tooling that expects POSIX-style quoting. That’s not a flaw in VS Code. It’s just how the shell behaves. If a command keeps failing due to quoting, run the same command in PowerShell and see if it behaves better there.

Set Your Default Terminal In VS Code

Start inside VS Code and let it detect shells first. Then pick the one you want as the default.

  1. Open VS Code.
  2. Open the terminal panel: Terminal → New Terminal.
  3. Open the command palette: Ctrl+Shift+P.
  4. Run Terminal: Select Default Profile.
  5. Choose PowerShell, PowerShell 7 (often shown as pwsh), or Command Prompt.

If you want official details on how profiles are detected and stored in settings, the VS Code docs spell out the exact settings names you’ll use. VS Code Terminal Profiles shows the profile layout and the default-profile workflow.

Installing PowerShell And CMD For VS Code With Stable Defaults

Picking a default profile in the UI is fine. Writing the profiles into settings.json makes the setup steadier across updates and easier to share with a teammate. This section gives safe defaults you can paste and then adjust.

Add Windows Profiles In settings.json

Open settings JSON: Ctrl+Shift+PPreferences: Open User Settings (JSON). Then add or merge the block below. Adjust the paths if your install differs.

{
  "terminal.integrated.profiles.windows": {
    "PowerShell 7": {
      "path": "C:\\\\Program Files\\\\PowerShell\\\\7\\\\pwsh.exe"
    },
    "Windows PowerShell": {
      "path": "C:\\\\Windows\\\\System32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe"
    },
    "Command Prompt": {
      "path": "C:\\\\Windows\\\\System32\\\\cmd.exe",
      "args": []
    }
  },
  "terminal.integrated.defaultProfile.windows": "PowerShell 7"
}

If you want CMD as the default, change the last line to "Command Prompt". If you want Windows PowerShell 5.1, pick that entry instead.

User Settings Versus Workspace Settings

User settings apply to all folders you open. Workspace settings apply only to the current folder. If you work across many repos and want one default everywhere, set it at the user level. If one repo needs CMD for a batch build, set the default profile inside that workspace and keep your user default unchanged.

Make The Terminal Open In The Folder You Expect

Most people want the terminal to open in the workspace root or the current file’s folder. VS Code often does this by default. When it doesn’t, set a fixed starting directory.

  • Use the workspace root: "terminal.integrated.cwd": "${workspaceFolder}"
  • Use the folder of the active file: "terminal.integrated.cwd": "${fileDirname}"

Pick one. If your tasks expect the repo root, workspace start is cleaner. If you bounce between folders inside a repo, file-based start can feel nicer.

Table: Setup Tweaks That Solve Real Terminal Headaches

Change Where What You Get
Install PowerShell 7 Windows Modern pwsh shell that runs side-by-side with 5.1
Select default profile VS Code command palette New terminals open in your chosen shell
Define explicit profiles settings.json Stable names and paths, easier to share and troubleshoot
Set a terminal start folder terminal.integrated.cwd Terminal opens in repo root or file folder, not a random path
Confirm PATH for tools Shell command line git, node, python run without full paths
Use CMD for batch scripts Workspace settings Batch builds run with native .bat behavior
Use PowerShell for scripts Terminal dropdown Richer scripting with objects in pipelines
Keep both shells available Terminal new profile menu Switch shells per task without leaving VS Code

Switch Between PowerShell And CMD Without Changing Defaults

You don’t need to change your default profile every time. Open multiple terminals, each with its own shell.

  1. Open the terminal panel.
  2. Click the dropdown next to the plus icon.
  3. Select PowerShell 7 or Command Prompt.
  4. Rename the terminal tab if you like, so you don’t lose track.

This pattern works well when you run a PowerShell script in one tab and a legacy batch file in another.

Fix The Most Common Problems

PowerShell Opens Then Closes Right Away

This usually means the executable path is wrong or blocked. In VS Code, open a normal terminal outside the editor and run the same path you put in your profile. If it fails there, VS Code can’t launch it either.

  • Check the file exists at the configured path.
  • If you installed via Store, the executable location differs from MSI installs. Use where pwsh and copy the real path into your profile.
  • Restart VS Code after changing terminal settings.

Commands Work In One Shell But Not The Other

PowerShell and CMD do not parse commands the same way. Paths with spaces, quotes, and pipes can behave differently. When a command fails, try these checks:

  • Run where git (or the tool name) in both shells. If one shell can’t find it, fix PATH.
  • Try a full path to the executable once to confirm the tool runs.
  • Match the script type to the shell: .ps1 in PowerShell, .bat in CMD.

Execution Policy Blocks A PowerShell Script

If you try to run a local PowerShell script and get a policy error, that’s Windows policy doing its job. The safest fix in managed setups is script signing. On personal machines, many people use scope-limited policy settings. If you don’t control the machine, follow your org’s rules.

Inside VS Code, also confirm you’re running the script in the correct shell. Running a .ps1 file from CMD won’t behave the way you expect.

The Terminal Starts In The Wrong Folder

If you open a file from outside the workspace, VS Code can pick a folder you didn’t expect. Set terminal.integrated.cwd as shown earlier. Also check whether you opened a single-file window instead of a folder window.

Fonts, Wrapping, Or Cursor Visibility Feel Off

Terminal styling comes from VS Code settings and your shell theme. If text wraps in odd places or the cursor is hard to see, raise terminal font size or change terminal font family in settings. Keep it readable and consistent with your editor.

Install Notes For macOS And Linux

CMD is Windows-only. PowerShell is cross-platform. If you move between Windows and a Unix-like system, installing PowerShell 7 gives you a familiar shell that behaves the same way on each OS for most commands.

On macOS and Linux, install PowerShell using the package options listed in Microsoft’s install docs, then set the default profile using the same Terminal: Select Default Profile command inside VS Code. Your settings keys change from .windows to .osx or .linux, yet the pattern stays the same.

Table: Quick Troubleshooting Map

Symptom Fast Check Fix
PowerShell tab closes instantly Run the profile path in an external terminal Correct the executable path, then restart VS Code
git works in PowerShell, fails in CMD where git in both shells Repair PATH so both shells see the same tool install
Terminal opens in a random folder Check if you opened a single file window Open the repo folder, set terminal.integrated.cwd
PowerShell scripts won’t run Read the policy error text Follow local policy rules; run .ps1 in PowerShell
CMD batch file fails in PowerShell Run it from a CMD tab Use CMD for .bat scripts, or port to PowerShell
Wrong shell launches after updates Check terminal.integrated.defaultProfile Define explicit profiles in JSON so names stay stable

A Simple Workflow Once It’s Set

After setup, treat terminals as task tabs. Keep one PowerShell tab for scripting and tooling, and one CMD tab for batch jobs or legacy installers. Match the shell to the script type and you’ll spend less time untangling errors.

If you work on multiple repos, set a user default that fits most work, then override at the workspace level for the few projects that need a different shell. That keeps your daily setup stable while still letting each repo run its own build style.

References & Sources