Visual Studio Code, how to switch from powershell.exe to cmd.exe
Asked Answered
D

8

112

I would like to switch from powershell.exe to cmd.exe in the terminal, but how can I do so?

I provided a screenshot for clarification.

Screenshot 1

Screenshot 2

Dacha answered 10/3, 2017 at 22:58 Comment(2)
code.visualstudio.com/docs/editor/integrated-terminalMackintosh
what's the problem? You want to switch the default terminal profile? From the screenshot, it's obvious you know how to change the current profile. But that's what it seems like you're asking how to do from the rest of what you've written.Sergio
W
240
  1. Press Ctrl + Shift + P to show all commands.
  2. Type profile in the displayed text box to filter the list.
  3. Select Terminal: Select Default Profile.
  4. You will be prompted to Select your preferred terminal shell, you can change this later in your settings or follow the same process as we do now
  5. Select Command Prompt (cmd.exe)
  6. Click the Delete Icon in the shell pane to remove the existing terminal.
  7. Press Ctrl + ` (or menu ViewTerminal in menu) to open a new terminal pane.
Weidman answered 3/5, 2017 at 5:29 Comment(5)
To take effect, requires VS Code to be shut down and relaunched on Windows 10.Train
@Train Right. Also you can click on + button to add new terminal. After adding you can select cmd from drop down.Dutyfree
In VSCode 1.55.2, I could not find an option called "Terminal: Select Default Shell". However, I did find "Terminal: Select Default Profile" which seems to do the same thing.Suazo
When I try to debug (using F5) it still uses PowerShell, any idea how I can solve this?Leifeste
@JoginderMalik My company's security suite blocks PS, which was the default, and the terminal panel disappears almost immediately after it opens. So there was not enough time to click the + drop down. This fixed it.Rousseau
W
22

2021 Update:

Hit Ctrl + Shift + P

Type/Paste: Terminal: Select Default Profile

Visual Studio Code Settings

Select the command prompt from the drop down list.

Enter image description here

Wrac answered 6/6, 2021 at 15:24 Comment(0)
D
16

Add this user setting to your menu FilePreferencesUser Settings

// Place your settings in this file to overwrite the default settings
{
    "terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",

}
Departure answered 10/3, 2017 at 23:27 Comment(2)
For me, this is was the solution {"terminal.integrated.defaultProfile.windows": "Git Bash"}Padraic
This setting is deprecated (circa version 1.57) see code.visualstudio.com/docs/terminal/profiles.Sergio
G
15

I found two different ways to switch from PowerShell to the command prompt in Visual Studio Code.

The very simple steps I found myself are as below:

The first one is also simple and handy for all developers.

  1. Press Ctrl + Shift + P to show all commands.
  2. Type shell in the displayed text box to filter the list.
  3. Select Terminal: Select Default Shell.
  4. You will be prompted to Select your preferred terminal shell. You can change this later in your settings or follow the same process as we do now
  5. Select Command Prompt (cmd.exe)
  6. Click the Delete Icon in the shell pane to remove the existing terminal.
  7. Press Ctrl + ` (or menu ViewTerminal in menu) to open a new terminal pane.

The second one is a very simple way:

  1. Press Ctrl + ` (or menu ViewTerminal in menu) to open a new terminal pane.

  2. Click terminal selection dropdown and click 'Select Default Shell'.

    Enter image description here

  3. Choose the terminal type Command Prompt or PowerShell

    Enter image description here

  4. Now delete the current opened terminal or open a new terminal.

Now, Command Prompt will be your default shell in Visual Studio Code.

Graphics answered 9/4, 2020 at 10:57 Comment(1)
I initially missed that drop down list that appears below the menu. If you click anywhere it will disappear. But this worked for me.Lody
W
3

Open settings (Ctrl + <comma>)

Find terminal.integrated.shell.windows

Replace its value with C:\\Windows\\System32\\cmd.exe.

Whitewall answered 5/12, 2017 at 9:23 Comment(1)
This setting is deprecated (circa version 1.57)Sergio
S
3

In the current terminal, simply type Cmd and Enter. And you are done.

Sleepy answered 8/12, 2020 at 7:52 Comment(1)
Only on a Mac, presumably?Hartsfield
P
2

I also faced this problem when I clicked on the terminal. It was showing PowerShell, but not Command Prompt, so I did the following steps to get Command Prompt in Visual Studio:

  1. Menu ViewCommand paletteToggle Integrated Terminal
  2. Open terminal by shortcut Ctrl + ` or menu ViewTerminal
  3. Write the command as cmd.exe and run
Photodrama answered 9/12, 2018 at 19:19 Comment(0)
T
0

From Visual Studio if you have PowerShell set as your default integrated terminal, after you call it with Ctrl + ` (control + backtick) - that toggles from the terminal to your files panel and back. Call the terminal, It will show as 1: pwsh in the dropdown box. From the PowerShell command line type bash and enter. You have your bash prompt $. In the dropdown you now see 1: Bash.

You can type cmd from either the ps C: or the $ Bash prompt and open the Windows command prompt. C:> and exit to exit them.

You can open up multiple terminals. Say PowerShell (pwsh) is your default one. A new terminal will show as 2: pwsh which you can change to a cmd one. The same if you open a third. Change it to Bash. You now have three terminals 1: pwsh, 2: cmd, and 3: bash. You can select whichever one you want to work with from the dropdown. You can of course exit any of them.

No doubt you've seen that when you are running Node.js, the terminal becomes node.

Tuttle answered 1/1, 2021 at 19:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.