VS Code is a wonderful IDE that I use everyday. Sometimes though, little issues crop up that require you to customize your installation. Today, we’ll talk about one of your options for customization: moving the extensions folder.
Table of Contents
Rationale
Over the years, I’ve used a lot of IDEs. My first IDE was DrJava in 2012, and it’s how I picked up programming. Later, I picked up other tools like Eclipse, vim, Atom, Visual Studios, Android Studios, Mono, and PyCharm (among others that I’m probably forgetting). Most recently, however, I have been fully converted to a VS Code user. It’s my go-to editor for just about anything I do with software these days.
Given my love for VS Code, I converted one of my classes from Eclipse to VS Code. However, despite my personal experience with VS Code, I have had to learn a lot about how it works. After all, it’s one thing to run into an issue on your own system. It’s another entirely to run into issues on over 100 systems at once.
With that said, I’ve largely run into fewer issues with VS Code than Eclipse, and students really love it. However, there was one issue I ran into this week that I have to talk about.
In computer science education, we have a lot of international students. This leads to all sorts of interesting problems that crop up in software development, especially for students who speak English as a second language.
For example, I have a student this semester who has their computer’s language set to Chinese. This leads to all sorts of interesting issues like paths containing Chinese characters. In this particular student’s case, their username was in Chinese, which meant that most paths read as something like C:\Users\水水水\...
. That’s the symbol for water for anyone curious.
Naturally, for whatever reason, not all software tools are expecting Chinese characters in the path (I assume due to encoding assumptions). As a result, it’s pretty common for some aspect of VS Code to fail here.
For this particular student, they weren’t able to run any of their code because the extension that runs Java was hanging on a path to the extensions folder. As a result, the extension was throwing errors with paths like C:\Users\???\...
, which clearly indicates an inability of the extension to handle Chinese characters.
Naturally, I tried a lot of different things like moving the repo below the users folder to change its path, but the Java extension was still looking for the extensions folder. As a result, I was curious if there was a way to move the extensions folder. As it turns out, there is!
Moving the Extensions Folder
There are a few different ways to safely move the extensions folder. Some of the options are not described in the VS Code documentation, so they may not be stable.
Changing the Path via Command Line Arguments
The first way is to set the location of the extensions folder using command line arguments. As it turns out, VS Code can be launched from the command line, and the application itself supports command line arguments. In this case, it’s as simple as launching VS Code as follows:
"C:\...\Code.exe" --extensions-dir="C:\VSCode\extensions"
In this case, the --extensions-dir
flag lets you tell VS Code where to look for extensions. Specifically, what I’ve done is add this flag to the VS Code shortcut, so when the shortcut is clicked, it launches with the appropriate setting.
From what I understand, this solution is not without risk. For example, if you update VS Code, it often prompts to restart. When it does, it won’t run the same command as the shortcut. As a result, the extensions folder will be back to its original location.
Changing the Path via Environment Variable
Therefore, an alternative solution is to set an environment variable for the extensions folder. While I’m not sure if an environment variable is documented, several folks (including myself) have concluded that the VSCODE_EXTENSIONS environment variable exists in the source code. Therefore, you can set this variable globally, so that no matter how VS Code is opened, you’ll have the correct extensions folder. If you want, you can temporarily test this as follows on Windows using the command line:
set VSCODE_EXTENSIONS="C:\path\to\extensions\folder"
Naturally, this will only set the environment variable for the duration of the terminal session. You’ll can set it permanently for the current user by changing set
to setx
in the code above.
Changing the Path via Symbolic Links
With that said, there is also a third possible solution: use symbolic links. This is a common technique that I always forget about, but basically you can route the default extensions location to anywhere you want using a symbolic link. To do this on Windows, it’s as straightforward as running the following command:
mklink /D "%USERPROFILE%\.vscode\extensions" "path\to\new\extensions\folder"
I personally haven’t tried this trick, so I am not sure of any pitfalls. That said, I saw it referenced in a few different threads (namely, here and here
).
Changing the Path via Portable Mode
Finally, you can always configure VS Code in portable mode. Unlike some of the previous solutions, this one is described in the VS Code documentation. The general premise is that you can store all of the related data for VSCode in one place, rather than in different locations around your system.
To enable portable mode, you need to download the VS Code archive (e.g., the zip). Then, you can go into the folder where the executable is and add your own data folder. This triggers portable mode, where all related user data is stored alongside the executable.
Personally, I am not a huge fan of this solution because it seems that the portable version of VS Code is static (i.e., cannot be upgraded). Therefore, as stated in the docs, if you want a newer version of VS Code, you’ll have to download a new version and move the extensions over manually:
The
data
folder can be moved to other VS Code installations. This is useful for updating your portable VS Code version, in which case you can move thedata
folder to a newer extracted version of VS Code.
That said, this would have solved the problem for my student!
The VS Code Rabbit Hole
The more I use VS Code, the more I learn about its intricacies and pitfalls. In this latest debacle, I learned about how extensions are stored and how to move those extensions around. I also was reminded of how few pieces of software are able to handle complex file paths. As I continue to teach, I’m sure I’ll be able to manage VS Code better than their own dev team.
With that said, let’s call this one here for the day! Naturally, there are more articles where this one came from:
- Migrating From Eclipse to VS Code: The Many Hurdles
- Why I Urge My Students to Use DrJava
- How to Convert Markdown to a PDF: 3 Quick Solutions
If you really enjoyed this article, consider supporting the site, even if just to help keep the lights on. You can do that by heading over to my list of ways to grow the site. Otherwise, thanks for reading! See you next time.
Recent Code Posts
Recently, I was thinking about how there are so many ways to approach software design. While some of these approaches have fancy names, I'm not sure if anyone has really thought about them...
Poetry 2.x was released in early 2025, and we just got around to migrating several of our open-source projects to the new major version. As a result, I wanted to share some of the lessons learned.