nbro
nbro

Reputation: 15837

Change default opening and saving location in Visual Studio Code?

Is it possible to change the default opening and saving location when trying to open and/or save a file.

The default location seems to be the root, but I would like it to be the desktop.

Upvotes: 45

Views: 40479

Answers (7)

NeutronStar
NeutronStar

Reputation: 230

To set the default open and save path in Visual Studio Code, follow the steps

  1. Find and open settings.json file.
  2. Find the key "files.dialog.defaultPath", if not present add it anywhere in the file (I added at the end).
  3. Specify the location where you want to open and save files and folders by default, e.g. "files.dialog.defaultPath": "D:\\Workspace\\JavaProjects" (You need to specify double backslash on Windows, also double quotes are included everywhere).
  4. Save and close the file. Open VS Code, click on Open File or Folder menuitem in File menu. VS Code will open System file and folder selection dialog with default path set as specified in the settings.json file.

Tested on VS Code 1.93.1 on Windows 11

Upvotes: 0

Herbert Van-Vliet
Herbert Van-Vliet

Reputation: 754

For Visual Studio Code (I'm on 1.82.0), do this:

File -> Preferences -> Settings
Enter "path" in the search
VSC should show "Files -> Dialog: Default Path" in the list at the top
Enter your desired path
Restart and check

Upvotes: 12

Gorillana
Gorillana

Reputation: 11

What worked for me:

Find the path of the folder - in my case it was in C:\Users\username\OneDrive\GitHub...

To change it:

  • Close VS Studio
  • Cut/copy the folder from the directory it's in
  • Paste into the folder into the directory you want it to Example: C:\Users\username\Desktop\GitHub\CS50...
  • Open up VS Code and it will prompt you to Find a folder (or such) for your Explorer
  • Click into the parent folder within the directory and opening the parent folder should open the subsequent children folders with your code.

Every file should open up as long as you open up the parent folder to the smaller directories.

Hope this helps. -Gorillana

Upvotes: 1

Saiful Rizal MDRamli
Saiful Rizal MDRamli

Reputation: 189

In case anyone is still looking for this, you set this in settings.json using the key "git.defaultCloneDirectory"

Upvotes: 3

CBFT
CBFT

Reputation: 302

You can change the location of your projects/solutions. File -> Open -> Projects/Solutions

To do this modify Tools -> Options -> Projects and Solutions -> Locations

I think that's the closest you can get.

Upvotes: -1

Zailux
Zailux

Reputation: 509

The topic is documented in multiroot workspaces. https://code.visualstudio.com/docs/editor/multi-root-workspaces

Just for reading, though I couldn't find default folder config by the first look into the article.

Upvotes: -3

Juliën
Juliën

Reputation: 9522

I haven't found anything in the Preferences settings that would support this, nor found anything stating that this is supported.

As you've stated yourself, the default location is the root of your system. At least, if you aren't working in a folder.

What you could do, of course, is simply open your ~/Desktop as a folder in VSCode. Then, automatically, your default save location is exactly as you'd like it to be.

Upvotes: 7

Related Questions