How to change folder that opened by default in VSCode?

Viewed 3953

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\ ?

4 Answers

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.

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

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.

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.

Related