Seamlessly Switch from PowerShell to Command Prompt in Visual Studio Code: A Step-by-Step Guide

Learn how to switch the integrated terminal in Visual Studio Code from PowerShell to Command Prompt (cmd.exe) for a streamlined coding experience.
Seamlessly Switch from PowerShell to Command Prompt in Visual Studio Code: A Step-by-Step Guide

Switching from PowerShell to Command Prompt in Visual Studio Code

Introduction

Visual Studio Code (VS Code) is a powerful and versatile code editor that supports multiple terminal types, allowing developers to choose the environment that best suits their needs. By default, VS Code may open the terminal using PowerShell, but many users prefer the classic Command Prompt (cmd.exe) for various reasons, such as familiarity or specific command compatibility. In this guide, we will walk you through the steps to switch from PowerShell to Command Prompt in Visual Studio Code.

Step-by-Step Guide to Change the Default Terminal

Changing the default terminal in Visual Studio Code is a straightforward process. Follow these steps to set Command Prompt as your default terminal:

Step 1: Open Visual Studio Code

Launch Visual Studio Code on your computer. You can do this by clicking on the VS Code icon in your applications or by searching for it through your operating system's search functionality.

Step 2: Access the Settings

Once VS Code is open, you need to access the settings. You can do this in several ways:

  • Click on the gear icon (⚙️) in the lower left corner of the window, and then select "Settings."
  • Press Ctrl + , on your keyboard to open the settings directly.

Step 3: Search for Terminal Settings

In the Settings tab, you will see a search bar at the top. Type terminal integrated shell into the search bar. This will filter the settings to show only those related to the integrated terminal.

Step 4: Configure the Default Terminal

Look for the setting labeled Terminal > Integrated > Shell: Windows. This setting allows you to specify which shell to use for the integrated terminal on Windows. By default, this is set to PowerShell.

To change it to Command Prompt, click on the Edit in settings.json link that appears under the setting. This will open the settings.json file where you can make manual edits.

Step 5: Edit the settings.json File

In the settings.json file, you need to add or modify the following line:

"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe"

Ensure that you use double backslashes (\\) as shown above, as single backslashes may lead to errors. Save the changes by pressing Ctrl + S.

Step 6: Open the Integrated Terminal

Now that you have configured the settings, you can open the integrated terminal in VS Code. You can do this by selecting Terminal from the top menu and then choosing New Terminal, or by using the shortcut Ctrl + ` (the backtick key).

Your terminal should now open with Command Prompt as the default shell instead of PowerShell.

Conclusion

Switching from PowerShell to Command Prompt in Visual Studio Code is a simple process that can enhance your coding experience by allowing you to work in the environment that you are most comfortable with. By following the steps outlined in this guide, you can easily customize your terminal settings to suit your preferences. Whether you are running scripts, managing files, or executing commands, having the right terminal at your fingertips can significantly improve your productivity.