43

I have open two folders inside a VS Code instance.

For example (folder name): A and B

I want to open the folder B in a new instance of VS Code, but there is no option to open by right-clicking on the folder.

enter image description here

Even Atom has the option to open the folder in a new instance.

enter image description here

1

9 Answers 9

43

This extension allows you to open a folder in a new vscode window.
Open Folder Context Menus for VS Code

Sign up to request clarification or add additional context in comments.

2 Comments

If all else fails, hope there's an extension to solve the gap/problem. Thanks for sharing!
Bless your sharing heart.
31

You can go via File > New window or ctrl+shift+n for a new window, and open the second folder there.

Or the "window.openFoldersInNewWindow" setting:

// Controls if folders should open in a new window or replace the last active window. // - default: folders will open in a new window unless a folder is picked from within the application (e.g. via the File menu) // - on: folders will open in a new window // - off: folders will replace the last active window // Note that there can still be cases where this setting is ignored (e.g. when using the -new-window or -reuse-window command line option). "window.openFoldersInNewWindow": "default", 

4 Comments

This answer is not related to the question I have asked.
Thanks, this worked for me. I found the option by pressing cmd+, and searching for open folders in new window. I set it to on and it now works fine.
for files use: openFileInNewWindow
@YashuMittal It is not exactly the answer to your question, but it was exactly what I was looking for when Google pointed me to this page.
11

Create a registry File e.g. OpenOnRightClick.reg

Add these lines to the file:

Windows Registry Editor Version 5.00 ; Open files [HKEY_CLASSES_ROOT\*\shell\Open with VS Code] @="Edit with VS Code" "Icon"="C:\\Users\\xx\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe,0" [HKEY_CLASSES_ROOT\*\shell\Open with VS Code\command] @="\"C:\\Users\\xx\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\" \"%1\"" ; This will make it appear when you right click ON a folder ; The "Icon" line can be removed if you don't want the icon to appear [HKEY_CLASSES_ROOT\Directory\shell\vscode] @="Open Folder as VS Code Project" "Icon"="\"C:\\Users\\xx\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\",0" [HKEY_CLASSES_ROOT\Directory\shell\vscode\command] @="\"C:\\Users\\xx\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\" \"%1\"" ; This will make it appear when you right click INSIDE a folder ; The "Icon" line can be removed if you don't want the icon to appear [HKEY_CLASSES_ROOT\Directory\Background\shell\vscode] @="Open Folder as VS Code Project" "Icon"="\"C:\\Users\\xx\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\",0" [HKEY_CLASSES_ROOT\Directory\Background\shell\vscode\command] @="\"C:\\Users\\xx\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\" \"%V\"" 

Change the location of visual studio code as per your installation directory Now just double click on the OpenOnRightClick.reg file, confirm if asked ! All done ! on you right click you will have a open with Code option.

Comments

10

Let's make it very simple

  1. In vscode , Go to Files --> New Window, as shown in the image below. This will open a blank vscode window, where we will open new project.

enter image description here

  1. Drag the project folder and drop it into the vscode. as shown in the below image

enter image description here

That's it. New blank window has the new project opened.

Another way is discussed below

  1. Go to Folder URL which you want to open in the vscode. On the file location, type in the URL cmd
  2. cmd prompt will open with the folder URL.
  3. In the cmd prompt, type code .
  4. Your folder will open in the new vscode window.

Comments

5

This is not the way it is asked in the question, but doing the same things in another way.

In windows, there is a simple way to open the folder in visual studio.

If you are in any folder just type cmd on top and press enter key, It will open the command prompt.

enter image description here

Then type code . and press enter. It will open the visual studio code with the current folder.

enter image description here

Comments

3

I also wanted that feature in my editor so I saved my settings and preferences and then I reinstalled VS Code in order to check the box that adds "Open with Code" as action in the context menu:

example

1 Comment

easiest solution. Nice!
3

If you have a x64 bit install of VS Code you can use this. This will give you new right click options in the Windows Explorer to open the folder as a project when right clicking in a folder and when right clicking a file as seen here:

Shift Right Clicking in a folder: VSCode Open Folder Context Menu

Right clicking a file

open
Save the .reg script something like openFolderAndFilesInVSCodeWithRightClickMenu.reg and add it to your registry.

Windows Registry Editor Version 5.00 ; Open files [HKEY_CLASSES_ROOT\*\shell\Open with VS Code] @="Edit with VS Code" "Icon"="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\",0" [HKEY_CLASSES_ROOT\*\shell\Open with VS Code\command] @="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\" \"%1\"" ; This will make it appear when you right click ON a folder ; The "Icon" line can be removed if you don't want the icon to appear [HKEY_CLASSES_ROOT\Directory\shell\vscode] @="Open Folder as VS Code Project" "Icon"="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\",0" [HKEY_CLASSES_ROOT\Directory\shell\vscode\command] @="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\" \"%1\"" ; This will make it appear when you right click INSIDE a folder ; The "Icon" line can be removed if you don't want the icon to appear [HKEY_CLASSES_ROOT\Directory\Background\shell\vscode] @="Open Folder as VS Code Project" "Icon"="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\",0" [HKEY_CLASSES_ROOT\Directory\Background\shell\vscode\command] @="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\" \"%V\""

Comments

2

Simplest way:

Drag the folder to the "main body" of vscode.

Comments

0

I added VSCode shortcut (VSCode.lnk) to Window's SendTo folder (\Microsoft\Windows\SendTo).

Now I right mouse button click on project folder, navigate to SendTo then select VSCode. I cannot say what applications it will/will not work for but worth a try...very easy and easy to undo as well.

In my case I opened Arduino cpp project in VSCode.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.