48

I have small problem with VSCode folder, that opened by default.

Problem description: I start new instance of VSCode (trough File->New Window), and then if I choose File->Open Folder it opens dialog with my Windows user folder as starting point (C:\Users\MyUser)

Question: How can I change that folder in settings (if it possible)? So by default it will show as start point for example D:\development\ ?

1
  • 3
    you can add `D:\development` as a favourite of Windows Explorer, then it is just a click away Commented Nov 23, 2021 at 14:37

8 Answers 8

57

At last, a new feature has been merged regarding this issue: next release of VS Code should have a new setting files.dialog.defaultPath giving the option to specify the default path for dialogs. It is available in version 1.80.

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

5 Comments

On Mac, how would I set this up for a directory like ~/src? Adding the root makes it yell, and just doing /src is not working.
Yea! Great answer, works on Ubuntu
@niclake Try replacing ~ with the full path to your home directory, e.g. /home/users/foo
1.92, still doesn't work. I have :files.dialog.defaultPath: "/projects" in my settings.json but it doesn't change anything, VSCode is always opening my home directory.
@Onkeltem it does work on my end. Are you using a full path or a relative one? Also, there are settings layers, may be another layer is overriding your default path. Edit: I just saw that your setting entry is missing quotes on the key side. It is JSON based, it should look like this "files.dialog.defaultPath": "/projects"
13

In addition to top (absolutely correct) answer.

I am relatively new to VSCode and it took me some time to discover where to write those settings (files.dialog.defaultPath).

So, what we need to do with steps:

  1. In VSCode -> File -> Preferences -> Settings or use shortcut Ctrl+, (ctrl with comma).
  2. Search for word dialog
  3. Required setting Dialog: Default path will be the first result
  4. Paste the required path into the text field. In my case, it's: F:\FlutterProjects

I am on Windows. I hope it is the same on Mac/Linux.

Comments

11
+100

At the time I write this answer, this is not possible. There are two problems on Windows, and one problem on Mac and Linux:

  1. VS Code does not provide a default path to the file dialog 1. It does remember the last folder that you opened a file in, but that path cannot be used as a default because it is overwritten constantly.

  2. On Windows only, Electron ignores the default path when creating a file dialog if the default path is a directory 2.

An extension also cannot solve this, because extensions are not allowed to modify the File menu 3.

I think the best option at this point is to pin a folder to the Quick Access area in Windows Explorer, as suggested in a comment, or to put an actual shortcut in the user profile folder.

Workspaces and File > Open Recent may also be helpful if you often open the same folders.

1 Comment

This is really awkward behavior. But thanks for the explanation and the tip.
3

In Windows 10 at least, if you edit the shortcut for opening the application and add the desired path after the path to the actual VS Code executable it opens VS Code to your desired folder:

Edit shortcut dialog

Comments

1

Your main problem is that you are unable to open your specific folder in VScode. To solve that you can simply open the terminal/cmd in that specific window by just typing cmd in your search bar or just by pressing shift+right-click in that folder.

Now your cmd is open and you just have to type "code ." in the cmd and press enter to open the current folder in your VSCode. In case that code . doesn't work for you then you have to add the Vscode in the environment variables of your windows.

enter image description here

Comments

0

Visual Studio doesn't provide a specific feature to open a specific path. But there is a solution to your problem. You are saying that you want D:\develpment as a default when you open VS Code. You can go to that specific directory or create shortcut to desktop then click right click on that folder and then click on open with code. If you didnot see open with code then reinstall your VS code and check on open with code when you are reinstalling VS Code.

Comments

0

make a shortcut on the desktop for vscode and then modify it and add the folder after the .exe command. This will default open that folder when you double click on it.

Comments

-3

Visual Studio Code can be installed in two ways - User setup and System setup. I strongly believe you have User setup installed in your PC. Try re-installing it System-wide. That should probably fix your problem.

For more information: https://code.visualstudio.com/docs/setup/windows#_user-setup-versus-system-setup

PS: A lot more information is needed, you can share a screenshot of the window and elaborate more on it.

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.