乐闻世界logo
搜索文章和话题

How do I open multiple instances of Visual Studio Code?

1个答案

1

To open multiple instances of Visual Studio Code on Windows or macOS, there are several methods you can use:

Method 1: Using the New Window Option

  1. Open an already running instance of Visual Studio Code.
  2. Click the 'File' menu (Windows) or 'File' menu (Mac).
  3. Select 'New Window' (a new window will open).
  4. In the new window, you can open a different project or folder to run multiple instances.

Method 2: Opening Directly from the Command Line

On Windows or macOS, you can use the following command to open a new Visual Studio Code instance:

bash
code -n /path/to/directory

Here, /path/to/directory is the path to the directory you want to open in the new instance. The -n flag ensures a new window is opened.

For example, if I want to open the project located at C:\Projects\MyProject in a new instance, I would enter in the command line:

bash
code -n C:\Projects\MyProject

Method 3: Opening from the Taskbar or Dock

  • Windows: Locate the pinned Visual Studio Code icon in the taskbar, then hold down the Shift key while clicking it to open a new instance.
  • Mac: Find the Visual Studio Code icon in the Dock, then right-click and select 'New Window'.

Use Case Example

Suppose I am developing a frontend project and also need to view and debug a related backend API project. I can open two Visual Studio Code instances—one for the frontend project and another for the backend project. This allows for more convenient cross-project work without constantly switching between different project folders in the same window.

These are several methods to open multiple instances of Visual Studio Code. I hope this information is helpful to you!

2024年8月10日 02:39 回复

你的答案